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

Method test_zeroinputs

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

Source from the content-addressed store, hash-verified

1025
1026class TestDistributions(unittest.TestCase):
1027 def test_zeroinputs(self):
1028 # Verify that distributions can handle a series of zero inputs'
1029 g = random.Random()
1030 x = [g.random() for i in range(50)] + [0.0]*5
1031 g.random = x[:].pop; g.uniform(1,10)
1032 g.random = x[:].pop; g.paretovariate(1.0)
1033 g.random = x[:].pop; g.expovariate(1.0)
1034 g.random = x[:].pop; g.expovariate()
1035 g.random = x[:].pop; g.weibullvariate(1.0, 1.0)
1036 g.random = x[:].pop; g.vonmisesvariate(1.0, 1.0)
1037 g.random = x[:].pop; g.normalvariate(0.0, 1.0)
1038 g.random = x[:].pop; g.gauss(0.0, 1.0)
1039 g.random = x[:].pop; g.lognormvariate(0.0, 1.0)
1040 g.random = x[:].pop; g.vonmisesvariate(0.0, 1.0)
1041 g.random = x[:].pop; g.gammavariate(0.01, 1.0)
1042 g.random = x[:].pop; g.gammavariate(1.0, 1.0)
1043 g.random = x[:].pop; g.gammavariate(200.0, 1.0)
1044 g.random = x[:].pop; g.betavariate(3.0, 3.0)
1045 g.random = x[:].pop; g.triangular(0.0, 1.0, 1.0/3.0)
1046
1047 def test_avg_std(self):
1048 # Use integration to test distribution average and standard deviation.

Callers

nothing calls this directly

Calls 12

uniformMethod · 0.95
paretovariateMethod · 0.95
expovariateMethod · 0.95
weibullvariateMethod · 0.95
vonmisesvariateMethod · 0.95
normalvariateMethod · 0.95
gaussMethod · 0.95
lognormvariateMethod · 0.95
gammavariateMethod · 0.95
betavariateMethod · 0.95
triangularMethod · 0.95
randomMethod · 0.45

Tested by

no test coverage detected