MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_zeroinputs

Method test_zeroinputs

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

Source from the content-addressed store, hash-verified

1023
1024class TestDistributions(unittest.TestCase):
1025 def test_zeroinputs(self):
1026 # Verify that distributions can handle a series of zero inputs'
1027 g = random.Random()
1028 x = [g.random() for i in range(50)] + [0.0]*5
1029 g.random = x[:].pop; g.uniform(1,10)
1030 g.random = x[:].pop; g.paretovariate(1.0)
1031 g.random = x[:].pop; g.expovariate(1.0)
1032 g.random = x[:].pop; g.expovariate()
1033 g.random = x[:].pop; g.weibullvariate(1.0, 1.0)
1034 g.random = x[:].pop; g.vonmisesvariate(1.0, 1.0)
1035 g.random = x[:].pop; g.normalvariate(0.0, 1.0)
1036 g.random = x[:].pop; g.gauss(0.0, 1.0)
1037 g.random = x[:].pop; g.lognormvariate(0.0, 1.0)
1038 g.random = x[:].pop; g.vonmisesvariate(0.0, 1.0)
1039 g.random = x[:].pop; g.gammavariate(0.01, 1.0)
1040 g.random = x[:].pop; g.gammavariate(1.0, 1.0)
1041 g.random = x[:].pop; g.gammavariate(200.0, 1.0)
1042 g.random = x[:].pop; g.betavariate(3.0, 3.0)
1043 g.random = x[:].pop; g.triangular(0.0, 1.0, 1.0/3.0)
1044
1045 def test_avg_std(self):
1046 # 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