mirror of
https://github.com/python/cpython.git
synced 2025-08-09 03:19:15 +00:00
bpo-44018: random.seed() no longer mutates its inputs (GH-25856) (GH-25864)
This commit is contained in:
parent
8a595744e6
commit
e733e9951d
3 changed files with 7 additions and 2 deletions
|
@ -57,6 +57,11 @@ class TestBasicOps:
|
|||
self.assertRaises(TypeError, self.gen.seed, 1, 2, 3, 4)
|
||||
self.assertRaises(TypeError, type(self.gen), [])
|
||||
|
||||
def test_seed_no_mutate_bug_44018(self):
|
||||
a = bytearray(b'1234')
|
||||
self.gen.seed(a)
|
||||
self.assertEqual(a, bytearray(b'1234'))
|
||||
|
||||
@unittest.mock.patch('random._urandom') # os.urandom
|
||||
def test_seed_when_randomness_source_not_found(self, urandom_mock):
|
||||
# Random.seed() uses time.time() when an operating system specific
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue