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

Method test_randomize

Lib/test/test_regrtest.py:163–183  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

161 self.assertTrue(ns.header)
162
163 def test_randomize(self):
164 for opt in ('-r', '--randomize'):
165 with self.subTest(opt=opt):
166 ns = self.parse_args([opt])
167 self.assertTrue(ns.randomize)
168
169 with os_helper.EnvironmentVarGuard() as env:
170 # with SOURCE_DATE_EPOCH
171 env['SOURCE_DATE_EPOCH'] = '1697839080'
172 ns = self.parse_args(['--randomize'])
173 regrtest = main.Regrtest(ns)
174 self.assertFalse(regrtest.randomize)
175 self.assertIsInstance(regrtest.random_seed, str)
176 self.assertEqual(regrtest.random_seed, '1697839080')
177
178 # without SOURCE_DATE_EPOCH
179 del env['SOURCE_DATE_EPOCH']
180 ns = self.parse_args(['--randomize'])
181 regrtest = main.Regrtest(ns)
182 self.assertTrue(regrtest.randomize)
183 self.assertIsInstance(regrtest.random_seed, int)
184
185 def test_no_randomize(self):
186 ns = self.parse_args([])

Callers

nothing calls this directly

Calls 6

parse_argsMethod · 0.95
assertTrueMethod · 0.80
assertFalseMethod · 0.80
assertIsInstanceMethod · 0.80
subTestMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected