MCPcopy Create free account
hub / github.com/celery/celery / test_daylight

Method test_daylight

t/unit/utils/test_time.py:25–48  ·  view source on GitHub ↗
(self, patching)

Source from the content-addressed store, hash-verified

23class test_LocalTimezone:
24
25 def test_daylight(self, patching):
26 time = patching('celery.utils.time._time')
27 time.timezone = 3600
28 time.daylight = False
29 x = LocalTimezone()
30 assert x.STDOFFSET == timedelta(seconds=-3600)
31 assert x.DSTOFFSET == x.STDOFFSET
32 time.daylight = True
33 time.altzone = 3600
34 y = LocalTimezone()
35 assert y.STDOFFSET == timedelta(seconds=-3600)
36 assert y.DSTOFFSET == timedelta(seconds=-3600)
37
38 assert repr(y)
39
40 y._isdst = Mock()
41 y._isdst.return_value = True
42 assert y.utcoffset(datetime.now())
43 assert not y.dst(datetime.now())
44 y._isdst.return_value = False
45 assert y.utcoffset(datetime.now())
46 assert not y.dst(datetime.now())
47
48 assert y.tzname(datetime.now())
49
50 def test_fromutc_with_negative_offset(self, patching):
51 # Regression test for #10517: negative UTC offsets (western

Callers

nothing calls this directly

Calls 6

utcoffsetMethod · 0.95
dstMethod · 0.95
tznameMethod · 0.95
LocalTimezoneClass · 0.90
patchingFunction · 0.85
nowMethod · 0.45

Tested by

no test coverage detected