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

Method test_guaranteed_stable

Lib/test/test_random.py:656–665  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

654 gen = random.Random()
655
656 def test_guaranteed_stable(self):
657 # These sequences are guaranteed to stay the same across versions of python
658 self.gen.seed(3456147, version=1)
659 self.assertEqual([self.gen.random().hex() for i in range(4)],
660 ['0x1.ac362300d90d2p-1', '0x1.9d16f74365005p-1',
661 '0x1.1ebb4352e4c4dp-1', '0x1.1a7422abf9c11p-1'])
662 self.gen.seed("the quick brown fox", version=2)
663 self.assertEqual([self.gen.random().hex() for i in range(4)],
664 ['0x1.1239ddfb11b7cp-3', '0x1.b3cbb5c51b120p-4',
665 '0x1.8c4f55116b60fp-1', '0x1.63eb525174a27p-1'])
666
667 def test_bug_27706(self):
668 # Verify that version 1 seeds are unaffected by hash randomization

Callers

nothing calls this directly

Calls 4

seedMethod · 0.45
assertEqualMethod · 0.45
hexMethod · 0.45
randomMethod · 0.45

Tested by

no test coverage detected