Skip to content

Commit

Permalink
Merge pull request #103 from oscarbenjamin/pr_good
Browse files Browse the repository at this point in the history
Export good and ensure all tests run
  • Loading branch information
oscarbenjamin authored Nov 2, 2023
2 parents 9252d17 + 5333f75 commit 33e5485
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 4 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/buildwheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
1 change: 1 addition & 0 deletions doc/source/general.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/flint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
2 changes: 1 addition & 1 deletion src/flint/flint_base/flint_context.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
14 changes: 12 additions & 2 deletions src/flint/test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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,
Expand All @@ -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,
]

0 comments on commit 33e5485

Please sign in to comment.