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

Function _test_generator

Lib/random.py:963–977  ·  view source on GitHub ↗
(n, func, args)

Source from the content-addressed store, hash-verified

961## ----------------- test program -----------------------
962
963def _test_generator(n, func, args):
964 from statistics import stdev, fmean as mean
965 from time import perf_counter
966
967 t0 = perf_counter()
968 data = [func(*args) for i in _repeat(None, n)]
969 t1 = perf_counter()
970
971 xbar = mean(data)
972 sigma = stdev(data, xbar)
973 low = min(data)
974 high = max(data)
975
976 print(f'{t1 - t0:.3f} sec, {n} times {func.__name__}{args!r}')
977 print('avg %g, stddev %g, min %g, max %g\n' % (xbar, sigma, low, high))
978
979
980def _test(N=10_000):

Callers 1

_testFunction · 0.85

Calls 3

meanFunction · 0.90
stdevFunction · 0.90
funcFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…