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

Method test_choice

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

Source from the content-addressed store, hash-verified

117 self.assertRaises(TypeError, shuffle, (1, 2, 3))
118
119 def test_choice(self):
120 choice = self.gen.choice
121 with self.assertRaises(IndexError):
122 choice([])
123 self.assertEqual(choice([50]), 50)
124 self.assertIn(choice([25, 75]), [25, 75])
125
126 def test_choice_with_numpy(self):
127 # Accommodation for NumPy arrays which have disabled __bool__().

Callers

nothing calls this directly

Calls 4

choiceFunction · 0.85
assertInMethod · 0.80
assertRaisesMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected