MCPcopy Index your code
hub / github.com/python/cpython / test_issue23600

Method test_issue23600

Lib/test/datetimetester.py:242–262  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

240 self.assertNotHasAttr(derived, 'spam')
241
242 def test_issue23600(self):
243 DSTDIFF = DSTOFFSET = timedelta(hours=1)
244
245 class UKSummerTime(tzinfo):
246 """Simple time zone which pretends to always be in summer time, since
247 that's what shows the failure.
248 """
249
250 def utcoffset(self, dt):
251 return DSTOFFSET
252
253 def dst(self, dt):
254 return DSTDIFF
255
256 def tzname(self, dt):
257 return 'UKSummerTime'
258
259 tz = UKSummerTime()
260 u = datetime(2014, 4, 26, 12, 1, tzinfo=tz)
261 t = tz.fromutc(u)
262 self.assertEqual(t - t.utcoffset(), u)
263
264
265class TestTimeZone(unittest.TestCase):

Callers

nothing calls this directly

Calls 6

timedeltaClass · 0.90
datetimeClass · 0.90
UKSummerTimeClass · 0.85
fromutcMethod · 0.45
assertEqualMethod · 0.45
utcoffsetMethod · 0.45

Tested by

no test coverage detected