summaryrefslogtreecommitdiff
path: root/dateutil/parser/_parser.py
diff options
context:
space:
mode:
authorBrock Mendel <jbrockmendel@gmail.com>2017-11-06 15:26:14 -0800
committerPaul Ganssle <paul@ganssle.io>2017-11-15 08:47:31 -0500
commit6c42500d46b7b6280a7c8047ffaca3a7ad9aeb05 (patch)
tree52a4d98d957afa86f0081df2de97bef65942cc61 /dateutil/parser/_parser.py
parent616eb6ddd6fc26980b10fdee28c16af9b49d6721 (diff)
downloaddateutil-git-6c42500d46b7b6280a7c8047ffaca3a7ad9aeb05.tar.gz
change assertions to ValueError, stop catching AssertionError
Diffstat (limited to 'dateutil/parser/_parser.py')
-rw-r--r--dateutil/parser/_parser.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/dateutil/parser/_parser.py b/dateutil/parser/_parser.py
index 91a4182..e6181a7 100644
--- a/dateutil/parser/_parser.py
+++ b/dateutil/parser/_parser.py
@@ -416,11 +416,13 @@ class _ymd(list):
if hasattr(val, '__len__'):
if val.isdigit() and len(val) > 2:
self.century_specified = True
- assert label in [None, 'Y']
+ if label not in [None, 'Y']: # pragma: no cover
+ raise ValueError(label)
label = 'Y'
elif val > 100:
self.century_specified = True
- assert label in [None, 'Y']
+ if label not in [None, 'Y']: # pragma: no cover
+ raise ValueError(label)
label = 'Y'
super(self.__class__, self).append(int(val))
@@ -840,7 +842,7 @@ class parser(object):
res.month = month
res.day = day
- except (IndexError, ValueError, AssertionError):
+ except (IndexError, ValueError):
return None, None
if not info.validate(res):