Skip to content

Commit 71d1612

Browse files
Merge pull request #31 from oscarbenjamin/pr_doctest
fix: make test suite run doctests
2 parents 102d132 + e67a8e0 commit 71d1612

File tree

6 files changed

+55
-11
lines changed

6 files changed

+55
-11
lines changed

.github/workflows/buildwheel.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,25 @@ jobs:
7878
path: wheelhouse
7979
- run: pip install --find-links wheelhouse python_flint
8080
- run: python test/test.py
81+
82+
doctest_wheels:
83+
needs: build_wheels
84+
name: Doctests for ${{ matrix.python-version }} wheel on ${{ matrix.os }}
85+
runs-on: ${{ matrix.os }}
86+
strategy:
87+
fail-fast: false
88+
matrix:
89+
os: [ubuntu-20.04, windows-2019, macos-12]
90+
python-version: ['3.9', '3.10', '3.11']
91+
92+
steps:
93+
- uses: actions/checkout@v3
94+
- uses: actions/setup-python@v4
95+
with:
96+
python-version: ${{ matrix.python-version }}
97+
- uses: actions/download-artifact@v3
98+
with:
99+
name: artifact
100+
path: wheelhouse
101+
- run: pip install --find-links wheelhouse python_flint
102+
- run: python test/dtest.py

bin/build_dependencies_unix.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,13 @@ cd arb-$ARBVER
177177
--disable-static
178178
make -j3
179179
make install
180+
#
181+
# Here make check passes for Linux and OSX but fails for Windows probably
182+
# because of a linker error or something like that. It would be nice to
183+
# enable this check when it can work for Windows but for now we disable it
184+
# because if it fails then we don't get any wheels built.
185+
#
186+
# ARB_TEST_MULTIPLIER=0.1 make check
180187
cd ..
181188

182189
# ------------------------------------------------------------------------- #

src/flint/acb_mat.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ cdef class acb_mat(flint_mat):
666666
>>> sum(acb_mat(arb_mat.hilbert(20,20)).eig(nonstop=True))
667667
nan + nanj
668668
>>> showgood(lambda: sum(acb_mat(arb_mat.hilbert(20,20)).eig(nonstop=True)), parts=False)
669-
2.47967321036454 + [+/- 1.48e-56]j
669+
2.47967321036454 + 0e-55j
670670
671671
With default options, the method only succeeds if all eigenvalues can be
672672
isolated. Multiple (overlapping) eigenvalues can be handled by

src/flint/arb_mat.pyx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -616,10 +616,10 @@ cdef class arb_mat(flint_mat):
616616
magnitude have been replaced by exact zeros.
617617
618618
>>> print(arb_mat.stirling(4, 4).inv().str(5, radius=False))
619-
[1.0000, 0, 0, 0]
620-
[ 0, 1.0000, [+/- 1.20e-15], [+/- 5.00e-16]]
621-
[ 0, -1.0000, 1.0000, [+/- 1.67e-16]]
622-
[ 0, 1.0000, -3.0000, 1.0000]
619+
[1.0000, 0, 0, 0]
620+
[ 0, 1.0000, 0e-14, 0e-15]
621+
[ 0, -1.0000, 1.0000, 0e-15]
622+
[ 0, 1.0000, -3.0000, 1.0000]
623623
>>> print(arb_mat.stirling(4, 4).inv().chop(1e-6).str(5, radius=False))
624624
[1.0000, 0, 0, 0]
625625
[ 0, 1.0000, 0, 0]

test/dtest.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import sys
2+
import doctest
3+
import flint
4+
5+
sys.stdout.write("doctests...");
6+
fail, total = doctest.testmod(flint._flint);
7+
if fail == 0:
8+
print("OK")
9+
else:
10+
raise AssertionError("%i of %i doctests failed" % (fail, total))

test/test.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -446,9 +446,14 @@ def test_arb():
446446
sys.stdout.write("test_nmod_poly..."); test_nmod_poly(); print("OK")
447447
sys.stdout.write("test_nmod_mat..."); test_nmod_mat(); print("OK")
448448
sys.stdout.write("test_arb.."); test_arb(); print("OK")
449-
sys.stdout.write("doctests...");
450-
fail, total = doctest.testmod(flint);
451-
if fail == 0:
452-
print("OK")
453-
else:
454-
raise AssertionError("%i of %i doctests failed" % (fail, total))
449+
print("OK")
450+
#
451+
# The doctests currently fail on Windows so for now we separate them into a
452+
# separate test/doctest.py.
453+
#
454+
#sys.stdout.write("doctests...");
455+
#fail, total = doctest.testmod(flint._flint);
456+
#if fail == 0:
457+
# print("OK")
458+
#else:
459+
# raise AssertionError("%i of %i doctests failed" % (fail, total))

0 commit comments

Comments
 (0)