tests_runner

Methods used to interact with the randtests subpackage.

coinflip.tests_runner.list_tests() → Iterator[Tuple[str, Callable]][source]

List all available statistical tests

Yields:
  • randtest_name (str) – Name of statistical test
  • randtest_func (Callable) – Function object of the statistical test
exception coinflip.tests_runner.TestNotFoundError[source]

Error for when a statistical test is not found

coinflip.tests_runner.run_test(series: pandas.core.series.Series, randtest_name, **kwargs) → coinflip.randtests._result.TestResult[source]

Run a statistical test on RNG output

Parameters:
  • series (Series) – Output of the RNG being tested
  • randtest_name (str) – Name of statistical test
  • **kwargs – Keyword arguments to pass to statistical test
Returns:

result (TestResult) – Dataclass that contains the test’s statistic and p-value as well as other relevant information gathered.

Raises:
  • TestNotFoundError – If randtest_name does not match any available statistical tests
  • TestError – Errors raised when running randtest_name
coinflip.tests_runner.run_all_tests(series: pandas.core.series.Series) → Iterator[Tuple[str, coinflip.randtests._result.TestResult, Exception]][source]

Run all available statistical test on RNG output

Parameters:

series (Series) – Output of the RNG being tested

Yields:
  • randtest_name (str) – Name of statistical test
  • result (TestResult) – Dataclass that contains the test’s statistic and p-value as well as other relevant information gathered.
  • exception (NotImplementedError or MinimumInputError) – The exception raised when running randtest_name, otherwise None.
Raises:

NonBinarySequenceError – If series contains a sequence made of non-binary values