(self)
| 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__(). |
| 128 | # See: https://github.com/python/cpython/issues/100805 |
| 129 | choice = self.gen.choice |
| 130 | |
| 131 | class NA(list): |
| 132 | "Simulate numpy.array() behavior" |
| 133 | def __bool__(self): |
| 134 | raise RuntimeError |
| 135 | |
| 136 | with self.assertRaises(IndexError): |
| 137 | choice(NA([])) |
| 138 | self.assertEqual(choice(NA([50])), 50) |
| 139 | self.assertIn(choice(NA([25, 75])), [25, 75]) |
| 140 | |
| 141 | def test_sample(self): |
| 142 | # For the entire allowable range of 0 <= k <= N, validate that |
nothing calls this directly
no test coverage detected