- add `GF2` class in the `lalib.elements` sub-package implementing a typical Galois field with two elements - the singleton objects `one` and `zero` are the concrete instances of the `GF2` type for the end users - besides the typical Galois arithmetic, `one` and `zero` behave like the built-in numbers `1` and `0` and implement the `numbers.Rational` interface - add exhaustive docstrings with usage examples - add (unit) test cases with 100% coverage
24 lines
563 B
Python
24 lines
563 B
Python
"""Integrate `xdoctest` into the test suite.
|
|
|
|
Ensure all code snippets in docstrings are valid and functioning code.
|
|
|
|
Important: All modules with docstrings containing code snippets
|
|
must be put on the parameter list below by hand!
|
|
"""
|
|
|
|
import pytest
|
|
import xdoctest
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"module",
|
|
[
|
|
"lalib",
|
|
"lalib.elements.gf2",
|
|
],
|
|
)
|
|
def test_docstrings(module):
|
|
"""Test code snippets within the package with `xdoctest`."""
|
|
result = xdoctest.doctest_module(module, "all")
|
|
|
|
assert result["n_failed"] == 0
|