MCPcopy Create free account
hub / github.com/dateutil/dateutil / test_tzlocal_parse_fold

Method test_tzlocal_parse_fold

tests/test_parser.py:911–924  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

909 assert dt == dt_exp
910
911 def test_tzlocal_parse_fold(self):
912 # One manifestion of GH #318
913 with TZEnvContext('EST+5EDT,M3.2.0/2,M11.1.0/2'):
914 dt_exp = datetime(2011, 11, 6, 1, 30, tzinfo=tz.tzlocal())
915 dt_exp = tz.enfold(dt_exp, fold=1)
916 dt = parse('2011-11-06T01:30 EST')
917
918 # Because this is ambiguous, until `tz.tzlocal() is tz.tzlocal()`
919 # we'll just check the attributes we care about rather than
920 # dt == dt_exp
921 assert dt.tzname() == dt_exp.tzname()
922 assert dt.replace(tzinfo=None) == dt_exp.replace(tzinfo=None)
923 assert getattr(dt, 'fold') == getattr(dt_exp, 'fold')
924 assert dt.astimezone(tz.UTC) == dt_exp.astimezone(tz.UTC)
925
926
927def test_parse_tzinfos_fold():

Callers

nothing calls this directly

Calls 4

parseFunction · 0.90
TZEnvContextClass · 0.85
tznameMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected