aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Sebastiaan Zeeff <[email protected]>2019-10-03 07:14:31 +0200
committerGravatar Sebastiaan Zeeff <[email protected]>2019-10-03 07:14:31 +0200
commit629cb4d05405a155715da765a2408be9156eb215 (patch)
tree0e96fca8b3cc80ad66380e5d2b080d45cc5b6319
parentMake ISODateTime return tz-unaware datetime (diff)
Check if tzinfo is None in ISODateTime test
As we have decided that the converter should return naive datetime objects, we should explicitly test that datetime strings with a timezone offset are still converted to a naive datetime object. I have done this by adding a `tzinfo is None` assertion.
-rw-r--r--tests/test_converters.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/test_converters.py b/tests/test_converters.py
index 86e8f2249..f69995ec6 100644
--- a/tests/test_converters.py
+++ b/tests/test_converters.py
@@ -231,7 +231,9 @@ def test_duration_converter_for_invalid(duration: str):
)
def test_isodatetime_converter_for_valid(datetime_string: str, expected_dt: datetime.datetime):
converter = ISODateTime()
- assert asyncio.run(converter.convert(None, datetime_string)) == expected_dt
+ converted_dt = asyncio.run(converter.convert(None, datetime_string))
+ assert converted_dt.tzinfo is None
+ assert converted_dt == expected_dt
@pytest.mark.parametrize(