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

Method test_randint

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

Source from the content-addressed store, hash-verified

527 self.assertIn(randrange(MyIndex(5), MyIndex(15), MyIndex(2)), range(5, 15, 2))
528
529 def test_randint(self):
530 randint = self.gen.randint
531 self.assertIn(randint(2, 5), (2, 3, 4, 5))
532 self.assertEqual(randint(2, 2), 2)
533 self.assertIn(randint(MyIndex(2), MyIndex(5)), (2, 3, 4, 5))
534 self.assertEqual(randint(MyIndex(2), MyIndex(2)), 2)
535
536 self.assertRaises(ValueError, randint, 5, 2)
537 self.assertRaises(TypeError, randint)
538 self.assertRaises(TypeError, randint, 2)
539 self.assertRaises(TypeError, randint, 2, 5, 1)
540 self.assertRaises(TypeError, randint, 2.0, 5)
541 self.assertRaises(TypeError, randint, 2, 5.0)
542
543 def test_pickling(self):
544 for proto in range(pickle.HIGHEST_PROTOCOL + 1):

Callers

nothing calls this directly

Calls 5

randintFunction · 0.85
assertInMethod · 0.80
MyIndexClass · 0.70
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected