fix validators for additional test cases

This commit is contained in:
David Kilias 2020-11-07 19:48:17 +01:00
parent 1c46e5b925
commit c859a735ee

View file

@ -11,6 +11,8 @@ def empty(field: str) -> bool:
def iso_date(field: str) -> bool: def iso_date(field: str) -> bool:
if not field:
return False
try: try:
datetime.datetime.strptime(field, "%Y-%m-%d") datetime.datetime.strptime(field, "%Y-%m-%d")
return True return True
@ -19,6 +21,10 @@ def iso_date(field: str) -> bool:
def valid_iban(field: str) -> bool: def valid_iban(field: str) -> bool:
if not field:
return False
if not type(field) == str:
return False
try: try:
IBAN(field) IBAN(field)
return True return True
@ -27,6 +33,10 @@ def valid_iban(field: str) -> bool:
def valid_bic(field: str) -> bool: def valid_bic(field: str) -> bool:
if not field:
return False
if not type(field) == str:
return False
try: try:
BIC(field) BIC(field)
return True return True