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

Method test_choices_with_all_zero_weights

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

Source from the content-addressed store, hash-verified

345 choices(population=[1, 2], weights=[1e-323, 1e-323], k=5000)
346
347 def test_choices_with_all_zero_weights(self):
348 # See issue #38881
349 with self.assertRaises(ValueError):
350 self.gen.choices('AB', [0.0, 0.0])
351
352 def test_choices_negative_total(self):
353 with self.assertRaises(ValueError):

Callers

nothing calls this directly

Calls 2

choicesMethod · 0.80
assertRaisesMethod · 0.45

Tested by

no test coverage detected