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

Method test_choices_infinite_total

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

Source from the content-addressed store, hash-verified

354 self.gen.choices('ABC', [3, -5, 1])
355
356 def test_choices_infinite_total(self):
357 with self.assertRaises(ValueError):
358 self.gen.choices('A', [float('inf')])
359 with self.assertRaises(ValueError):
360 self.gen.choices('AB', [0.0, float('inf')])
361 with self.assertRaises(ValueError):
362 self.gen.choices('AB', [-float('inf'), 123])
363 with self.assertRaises(ValueError):
364 self.gen.choices('AB', [0.0, float('nan')])
365 with self.assertRaises(ValueError):
366 self.gen.choices('AB', [float('-inf'), float('inf')])
367
368 def test_gauss(self):
369 # Ensure that the seed() method initializes all the hidden state. In

Callers

nothing calls this directly

Calls 2

choicesMethod · 0.80
assertRaisesMethod · 0.45

Tested by

no test coverage detected