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

Method test_extreme_hashes

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

Source from the content-addressed store, hash-verified

5189 self.assertEqual(derived.tzname(), 'cookie')
5190
5191 def test_extreme_hashes(self):
5192 # If an attempt is made to hash these via subtracting the offset
5193 # then hashing a datetime object, OverflowError results. The
5194 # Python implementation used to blow up here.
5195 t = self.theclass(1, 1, 1, tzinfo=FixedOffset(1439, ""))
5196 hash(t)
5197 t = self.theclass(MAXYEAR, 12, 31, 23, 59, 59, 999999,
5198 tzinfo=FixedOffset(-1439, ""))
5199 hash(t)
5200
5201 # OTOH, an OOB offset should blow up.
5202 t = self.theclass(5, 5, 5, tzinfo=FixedOffset(-1440, ""))
5203 self.assertRaises(ValueError, hash, t)
5204
5205 def test_zones(self):
5206 est = FixedOffset(-300, "EST")

Callers

nothing calls this directly

Calls 2

FixedOffsetClass · 0.85
assertRaisesMethod · 0.45

Tested by

no test coverage detected