Skip to content

Commit

Permalink
changelog, change tzutc() to UTC, use tzstr(UTC)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrockmendel committed Mar 1, 2019
1 parent 1af100f commit 6bed92e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions 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)
10 changes: 5 additions & 5 deletions dateutil/test/test_parser.py
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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

Expand Down

0 comments on commit 6bed92e

Please sign in to comment.