lalib/tests/test_docstrings.py
Alexander Hess 4a5e316d0c
Add lalib.domains.Domain
- this class models domains from linear algebra
  and is needed for the `Vector` class to be created
- `Domain` wraps Python's built-in `frozenset` type
  + they must contain at least one label
  + as a convenience, so-called canonical `Domain`s
    (i.e., with labels `0`, `1`, ...) can be created
    by passing in a positive `int`eger to `Domain()`
- the `Domain.is_canonical` property indicates
  what kind a `Domain` is
- add unit tests for the class
- add extensive documentation for the class
2024-10-20 02:35:43 +02:00

33 lines
826 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.integration_test
@pytest.mark.parametrize(
"module",
[
"lalib",
"lalib.domains",
"lalib.elements",
"lalib.elements.galois",
"lalib.fields",
"lalib.fields.base",
"lalib.fields.complex_",
"lalib.fields.galois",
"lalib.fields.rational",
"lalib.fields.real",
],
)
def test_docstrings(module):
"""Test code snippets within the package with `xdoctest`."""
result = xdoctest.doctest_module(module, "all")
assert result["n_failed"] == 0