diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index 35f41f9d..64252e59 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -75,6 +75,28 @@ jobs: with: path: dist/*.tar.gz + test_rst: + needs: build_wheels + name: Test rst docs + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + with: + python-version: '3.12' + + - uses: actions/download-artifact@v3 + with: + name: artifact + path: wheelhouse + + - run: pip install --upgrade pip + - run: pip install pytest + - run: pip install --no-index --find-links wheelhouse python_flint + - run: pytest --doctest-glob='*.rst' doc/source + test_wheels: needs: build_wheels name: Test ${{ matrix.python-version }} wheel on ${{ matrix.os }} diff --git a/doc/source/general.rst b/doc/source/general.rst index 52156f0f..fb2ec9ac 100644 --- a/doc/source/general.rst +++ b/doc/source/general.rst @@ -46,6 +46,7 @@ The user can mutate the properties directly, for example:: >>> fmpq(3,2) fmpq(3,2) >>> ctx.pretty = True + >>> fmpq(3,2) 3/2 Calling ``ctx.default()`` restores the default settings. diff --git a/src/flint/__init__.py b/src/flint/__init__.py index de90e314..bda516f9 100644 --- a/src/flint/__init__.py +++ b/src/flint/__init__.py @@ -24,6 +24,6 @@ from .types.fmpz_mod import * from .types.fmpz_mod_poly import * from .types.dirichlet import * -from .functions.showgood import showgood +from .functions.showgood import good, showgood __version__ = '0.5.0' diff --git a/src/flint/flint_base/flint_context.pyx b/src/flint/flint_base/flint_context.pyx index c73c83bc..b344ddc8 100644 --- a/src/flint/flint_base/flint_context.pyx +++ b/src/flint/flint_base/flint_context.pyx @@ -63,7 +63,7 @@ cdef class FlintContext: "prec = %-8s # real/complex precision (in bits)\n" \ "dps = %-8s # real/complex precision (in digits)\n" \ "cap = %-8s # power series precision\n" \ - "threads = %-8s # max number of threads used internally\n" % \ + "threads = %-8s # max number of threads used internally" % \ (self.pretty, self.unicode, self.prec, self.dps, self.cap, self.threads) def cleanup(self): diff --git a/src/flint/test/test.py b/src/flint/test/test.py index 2d82e821..aab785ee 100644 --- a/src/flint/test/test.py +++ b/src/flint/test/test.py @@ -30,7 +30,7 @@ def raises(f, exception): prec = 53 # real/complex precision (in bits) dps = 15 # real/complex precision (in digits) cap = 10 # power series precision -threads = 1 # max number of threads used internally +threads = 1 # max number of threads used internally\ """ def test_pyflint(): @@ -78,6 +78,9 @@ def test_pyflint(): assert raises(lambda: setattr(ctx, "prec", -1), ValueError) assert raises(lambda: setattr(ctx, "dps", -1), ValueError) +def test_showgood(): + from flint import good, showgood + def test_fmpz(): assert flint.fmpz() == flint.fmpz(0) L = [0, 1, 2, 3, 2**31-1, 2**31, 2**63-1, 2**63, 2**64-1, 2**64] @@ -2422,10 +2425,14 @@ def setbad(obj, i, val): if is_field: assert P([1, 2, 1]).integral() == P([0, 1, 1, S(1)/3]) - +def test_all_tests(): + test_funcs = {f for name, f in globals().items() if name.startswith("test_")} + untested = test_funcs - set(all_tests) + assert not untested, f"Untested functions: {untested}" all_tests = [ test_pyflint, + test_showgood, test_fmpz, test_fmpz_factor, test_fmpz_functions, @@ -2441,9 +2448,12 @@ def setbad(obj, i, val): test_nmod, test_nmod_poly, test_nmod_mat, + test_nmod_series, test_arb, test_fmpz_mod, test_fmpz_mod_dlog, test_fmpz_mod_poly, test_polys, + test_pickling, + test_all_tests, ]