From c859a735eead481b21b88a8a40a60cb21f528497 Mon Sep 17 00:00:00 2001 From: David Kilias Date: Sat, 7 Nov 2020 19:48:17 +0100 Subject: [PATCH] fix validators for additional test cases --- validators/validators.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/validators/validators.py b/validators/validators.py index aadab3e..9ff8f47 100644 --- a/validators/validators.py +++ b/validators/validators.py @@ -11,6 +11,8 @@ def empty(field: str) -> bool: def iso_date(field: str) -> bool: + if not field: + return False try: datetime.datetime.strptime(field, "%Y-%m-%d") return True @@ -19,6 +21,10 @@ def iso_date(field: str) -> bool: def valid_iban(field: str) -> bool: + if not field: + return False + if not type(field) == str: + return False try: IBAN(field) return True @@ -27,6 +33,10 @@ def valid_iban(field: str) -> bool: def valid_bic(field: str) -> bool: + if not field: + return False + if not type(field) == str: + return False try: BIC(field) return True