diff --git a/changelog.d/891.misc.rst b/changelog.d/891.misc.rst new file mode 100644 index 000000000..842a13c65 --- /dev/null +++ b/changelog.d/891.misc.rst @@ -0,0 +1,2 @@ +Added tests for tzinfos input types, fix missed case of invalid type. +Patch by @jbrockmendel (gh pr #891) diff --git a/dateutil/test/test_parser.py b/dateutil/test/test_parser.py index 3f6ccfc31..eda89e06c 100644 --- a/dateutil/test/test_parser.py +++ b/dateutil/test/test_parser.py @@ -262,15 +262,15 @@ def test_invalid_tzinfo_input(self): def test_valid_tzinfo_tzinfo_input(self): dstr = "2014 January 19 09:00 UTC" - tzinfos = {"UTC": tz.tzutc()} - expected = datetime(2014, 1, 19, 9, tzinfo=tz.tzutc()) + tzinfos = {"UTC": tz.UTC} + expected = datetime(2014, 1, 19, 9, tzinfo=tz.UTC) res = parse(dstr, tzinfos=tzinfos) assert res == expected def test_valid_tzinfo_unicode_input(self): dstr = "2014 January 19 09:00 UTC" tzinfos = {u"UTC": u"UTC+0"} - expected = datetime(2014, 1, 19, 9, tzinfo=tz.tzutc()) + expected = datetime(2014, 1, 19, 9, tzinfo=tz.UTC) res = parse(dstr, tzinfos=tzinfos) assert res == expected @@ -280,7 +280,7 @@ def test_valid_tzinfo_callable_input(self): def tzinfos(*args, **kwargs): return u"UTC+0" - expected = datetime(2014, 1, 19, 9, tzinfo=tz.tzutc()) + expected = datetime(2014, 1, 19, 9, tzinfo=tz.tzstr("UTC+0")) res = parse(dstr, tzinfos=tzinfos) assert res == expected @@ -289,7 +289,7 @@ def tzinfos(*args, **kwargs): def test_valid_tzinfo_int_input(self): dstr = "2014 January 19 09:00 UTC" tzinfos = {u"UTC": -28800} - expected = datetime(2014, 1, 19, 9, tzinfo=tz.tzutc()) + expected = datetime(2014, 1, 19, 9, tzinfo=tz.UTC) res = parse(dstr, tzinfos=tzinfos) assert res == expected