[Libosinfo] [osinfo-db PATCH] tests, test_dates: Keep just one implementation of _parse_iso_date()
Fabiano Fidêncio
fidencio at redhat.com
Wed May 22 13:16:27 UTC 2019
As suggested by Cole, let's keep just one implementation of
_parse_iso_date() (the most compatible one) and avoid diverging over
time.
Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
tests/test_dates.py | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/tests/test_dates.py b/tests/test_dates.py
index 49df613..aca7472 100644
--- a/tests/test_dates.py
+++ b/tests/test_dates.py
@@ -8,14 +8,10 @@ import sys
from . import util
-if sys.version_info >= (3, 7):
- def _parse_iso_date(date_string):
- return datetime.date.fromisoformat(date_string)
-else:
- def _parse_iso_date(date_string):
- m = re.match("([0-9]{4})-([0-9]{2})-([0-9]{2})", date_string)
- assert m
- return datetime.date(int(m.group(1)), int(m.group(2)), int(m.group(3)))
+def _parse_iso_date(date_string):
+ m = re.match("([0-9]{4})-([0-9]{2})-([0-9]{2})", date_string)
+ assert m
+ return datetime.date(int(m.group(1)), int(m.group(2)), int(m.group(3)))
def _parse_date(date_string):
--
2.21.0
More information about the Libosinfo
mailing list