MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_extreme_hashes

Method test_extreme_hashes

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

Source from the content-addressed store, hash-verified

5002 self.assertEqual(derived.tzname(), 'cookie')
5003
5004 def test_extreme_hashes(self):
5005 # If an attempt is made to hash these via subtracting the offset
5006 # then hashing a datetime object, OverflowError results. The
5007 # Python implementation used to blow up here.
5008 t = self.theclass(1, 1, 1, tzinfo=FixedOffset(1439, ""))
5009 hash(t)
5010 t = self.theclass(MAXYEAR, 12, 31, 23, 59, 59, 999999,
5011 tzinfo=FixedOffset(-1439, ""))
5012 hash(t)
5013
5014 # OTOH, an OOB offset should blow up.
5015 t = self.theclass(5, 5, 5, tzinfo=FixedOffset(-1440, ""))
5016 self.assertRaises(ValueError, hash, t)
5017
5018 def test_zones(self):
5019 est = FixedOffset(-300, "EST")

Callers

nothing calls this directly

Calls 3

hashFunction · 0.85
FixedOffsetClass · 0.70
assertRaisesMethod · 0.45

Tested by

no test coverage detected