-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wip: add coverage testing #29
Conversation
There should be at least some coverage if one includes doctests? |
I'm running |
Maybe this is the doctest problem: In [11]: import flint
In [12]: import doctest
In [13]: doctest.testmod(flint)
Out[13]: TestResults(failed=0, attempted=0) |
Okay, here we go: In [23]: doctest.testmod(flint)
Out[23]: TestResults(failed=0, attempted=0)
In [24]: doctest.testmod(flint._flint)
**********************************************************************
File "/home/oscar/current/sympy/python-flint/src/flint/_flint.cpython-38-x86_64-linux-gnu.so", line ?, in flint._flint.__test__.acb_mat.eig (line 620)
Failed example:
showgood(lambda: sum(acb_mat(arb_mat.hilbert(20,20)).eig(nonstop=True)), parts=False)
Expected:
2.47967321036454 + [+/- 1.48e-56]j
Got:
2.47967321036454 + 0e-55j
**********************************************************************
File "/home/oscar/current/sympy/python-flint/src/flint/_flint.cpython-38-x86_64-linux-gnu.so", line ?, in flint._flint.__test__.arb_mat.chop (line 613)
Failed example:
print(arb_mat.stirling(4, 4).inv().str(5, radius=False))
Expected:
[1.0000, 0, 0, 0]
[ 0, 1.0000, [+/- 1.20e-15], [+/- 5.00e-16]]
[ 0, -1.0000, 1.0000, [+/- 1.67e-16]]
[ 0, 1.0000, -3.0000, 1.0000]
Got:
[1.0000, 0, 0, 0]
[ 0, 1.0000, 0e-14, 0e-15]
[ 0, -1.0000, 1.0000, 0e-15]
[ 0, 1.0000, -3.0000, 1.0000]
**********************************************************************
File "/home/oscar/current/sympy/python-flint/src/flint/_flint.cpython-38-x86_64-linux-gnu.so", line ?, in flint._flint.acb_mat.eig
Failed example:
showgood(lambda: sum(acb_mat(arb_mat.hilbert(20,20)).eig(nonstop=True)), parts=False)
Expected:
2.47967321036454 + [+/- 1.48e-56]j
Got:
2.47967321036454 + 0e-55j
**********************************************************************
File "/home/oscar/current/sympy/python-flint/src/flint/_flint.cpython-38-x86_64-linux-gnu.so", line ?, in flint._flint.arb_mat.chop
Failed example:
print(arb_mat.stirling(4, 4).inv().str(5, radius=False))
Expected:
[1.0000, 0, 0, 0]
[ 0, 1.0000, [+/- 1.20e-15], [+/- 5.00e-16]]
[ 0, -1.0000, 1.0000, [+/- 1.67e-16]]
[ 0, 1.0000, -3.0000, 1.0000]
Got:
[1.0000, 0, 0, 0]
[ 0, 1.0000, 0e-14, 0e-15]
[ 0, -1.0000, 1.0000, 0e-15]
[ 0, 1.0000, -3.0000, 1.0000]
**********************************************************************
4 items had failures:
1 of 21 in flint._flint.__test__.acb_mat.eig (line 620)
1 of 2 in flint._flint.__test__.arb_mat.chop (line 613)
1 of 21 in flint._flint.acb_mat.eig
1 of 2 in flint._flint.arb_mat.chop
***Test Failed*** 4 failures.
Out[24]: TestResults(failed=4, attempted=1568) Looks like the doctests were not being run before. They take a lot longer than the other tests. Perhaps that makes they're more comprehensive... This diff is needed: diff --git a/test/test.py b/test/test.py
index 88f781b..3f0d741 100644
--- a/test/test.py
+++ b/test/test.py
@@ -447,7 +447,7 @@ if __name__ == "__main__":
sys.stdout.write("test_nmod_mat..."); test_nmod_mat(); print("OK")
sys.stdout.write("test_arb.."); test_arb(); print("OK")
sys.stdout.write("doctests...");
- fail, total = doctest.testmod(flint);
+ fail, total = doctest.testmod(flint._flint);
if fail == 0:
print("OK")
else: With that we have the failures shown above and coverage is: $ coverage report -m
Name Stmts Miss Cover Missing
---------------------------------------------------------
src/flint/__init__.py 1 0 100%
src/flint/acb.pyx 891 176 80% 1, 21-29, 38-40, 46, 49, 53-76, 82-83, 89, 91-94, 97, 126, 129, 131-140, 156-181, 188-189, 196, 237-242, 260-266, 274-293, 371, 374, 387, 390, 403, 406, 414-415, 421, 424, 435, 442, 445, 448, 456-459, 668-677, 1079-1097, 1286, 1492, 1517, 1522-1523, 1553, 1572, 1759-1760, 1774, 1791-1792, 1822, 1875-1876, 1890-1891, 1904-1905, 1920-1921, 1935-1936, 1950-1951, 1966-1967, 1982-1983, 1996-1997, 2183, 2196-2198, 2346-2347, 2362, 2367-2368, 2392, 2403-2404, 2471, 2473, 2475, 2477, 2479, 2486-2488, 2493-2494, 2509
src/flint/acb_mat.pyx 370 114 69% 1, 4, 7-14, 17, 37-38, 45-50, 57, 78-81, 83-86, 92, 96, 103-112, 127, 133-138, 144, 155, 164, 173-176, 208, 215-225, 233, 240, 249, 254-257, 270, 280-286, 295-296, 301, 303, 309, 316, 320, 322, 353, 394, 399-406, 413, 426, 441, 468, 473-474, 533, 568-578, 721, 735-738, 752, 762, 770
src/flint/acb_poly.pyx 233 179 23% 1-26, 47-65, 68, 79-89, 119-289, 318, 342, 366-371
src/flint/arb.pyx 835 180 78% 1, 8, 17-37, 53-54, 61-62, 77-78, 92, 99-101, 107, 110, 117-119, 125, 128, 185, 192, 195, 198-201, 235-250, 354-374, 458, 462, 471, 474, 487-496, 503-529, 558, 561, 574, 577, 590, 593, 604, 611, 614, 617, 870-871, 882-883, 894-895, 964-965, 1130-1131, 1203-1204, 1281-1282, 1301-1302, 1318-1319, 1360-1361, 1389-1390, 1401-1402, 1454, 1473, 1493-1494, 1509, 1516, 1519-1520, 1535, 1542, 1639, 1660, 1665-1666, 1694, 2080-2081, 2092-2093, 2104-2105, 2116-2117, 2128-2129, 2140-2141, 2152-2153, 2164-2165, 2176-2177, 2188-2204, 2226, 2245, 2251-2254, 2326-2327
src/flint/arb_mat.pyx 323 127 61% 1, 4, 7-18, 21-23, 47-48, 55-60, 67, 81-84, 86-89, 95, 99, 106-115, 130, 136-141, 147, 158, 167, 176-179, 198, 205-215, 223, 230, 235-247, 260, 270-276, 285-286, 291, 293, 299, 306, 310, 312, 342, 387, 392-399, 419, 434, 461, 466-467, 487-488, 517-518, 548, 554-555, 611, 649-667
src/flint/arb_poly.pyx 195 170 13% 1-14, 26-27, 41-57, 60-61, 71-81, 114-290
src/flint/arb_series.pyx 563 492 13% 1-12, 30, 32, 35-36, 38-39, 41, 43, 51-54, 60, 65-345, 358-476, 489-740, 776, 781, 802
src/flint/arf.pyx 109 85 22% 28, 37, 40-47, 53-89, 96-103, 108, 114-171
src/flint/dirichlet.pyx 56 27 52% 1, 27-28, 35, 41, 102-142, 155-161
src/flint/fmpq.pyx 181 67 63% 1, 43-44, 48, 53, 56, 67, 70, 78-83, 101-102, 106, 148, 151, 160, 163, 172, 180-181, 185, 188, 199, 239, 246-247, 262-263, 268-269, 282-331
src/flint/fmpq_mat.pyx 248 70 72% 1, 6, 62, 71, 78-81, 86, 89, 92, 98, 101, 109, 116-120, 150, 153, 158, 170, 173, 178, 184, 191, 199, 202, 208, 211, 217, 220, 240, 251-254, 257, 264, 335, 346, 348, 352, 386-387, 423-455
src/flint/fmpq_poly.pyx 234 75 68% 1, 21, 35, 71, 75, 77, 83, 86, 92, 95, 98, 114-115, 121, 127, 136, 159-172, 183, 186, 195, 198, 207, 210, 217-244, 250, 256, 265, 268, 270, 279, 296, 303-310, 344-345, 356-357, 368-369
src/flint/fmpq_series.pyx 349 265 24% 1, 7-20, 38, 40, 43-44, 46-47, 49, 51, 58-63, 68, 72-83, 89, 94-101, 107-141, 155-158, 171-176, 179, 185-186, 195, 200-201, 207, 210, 215-222, 229, 236, 241, 244, 246, 249-269, 282, 284, 292-487
src/flint/fmpz.pyx 340 110 68% 1, 11, 13-14, 18-20, 26-29, 33, 38-40, 47, 85, 90, 92, 99-102, 112-118, 131, 135, 292, 312, 327-335, 390-411, 445-446, 457-458, 470-471, 493-503, 514-515, 526-527, 538-539, 579-633
src/flint/fmpz_mat.pyx 268 59 78% 1, 92, 101, 108, 116, 119, 122, 128, 134, 145, 154, 195, 198, 213-229, 262-263, 270, 280, 286-287, 341-342, 358-359, 374-375, 434, 440, 510, 530, 610-613, 616-619, 696-706
src/flint/fmpz_poly.pyx 295 97 67% 1, 10-12, 20, 32-33, 62, 67, 70, 76, 79, 135-140, 154, 157, 166, 169, 178, 190, 193, 204, 207, 218, 221, 232, 249, 316, 333-334, 346-347, 359-360, 373-374, 387-388, 405, 411-412, 415, 418-419, 441-505
src/flint/functions.pyx 61 12 80% 2, 4, 14-16, 20, 25-27, 69, 79, 84, 88, 102
src/flint/nmod.pyx 96 16 83% 1, 21, 42, 54, 63, 74-77, 95, 112, 124-127, 135, 140, 146, 156
src/flint/nmod_mat.pyx 222 74 67% 1, 8-12, 38, 42-44, 62, 64-65, 71, 77, 86, 89, 96-98, 101, 104, 107-115, 149-164, 197, 200-204, 206, 218-239, 256, 264-265, 267, 269, 275-276, 279, 287, 292, 297, 343
src/flint/nmod_poly.pyx 199 49 75% 1, 18-20, 32, 65-69, 72, 79, 84, 87, 90, 97, 107, 133, 139-147, 161-164, 177, 181, 183, 194, 198, 200, 211, 215, 217, 230-234, 236, 238, 249-253, 255, 257, 271, 289, 291
src/flint/pyflint.pyx 132 15 89% 35, 41, 109, 122-131, 142, 148, 220, 235, 266-267, 270, 293
test/test.py 436 2 99% 16, 452
---------------------------------------------------------
TOTAL 6637 2461 63%
$ coverage report -m | grep pyx | wc -l
21
$ ls src/flint/*.pyx | wc -l
25
$ ls src/flint
acb_mat.pyx arb_series.pyx fmpq.pyx functions.pyx pyflint.c
acb_poly.pyx arf.pyx fmpq_series.pyx __init__.py pyflint.pxd
acb.pyx dirichlet.pyx fmpz_mat.pyx nmod_mat.pyx pyflint.pyx
acb_series.pyx _flint.cpython-38-x86_64-linux-gnu.so fmpz_mpoly.pyx nmod_poly.pyx
arb_mat.pyx _flint.pxd fmpz_poly.pyx nmod.pyx
arb_poly.pyx fmpq_mat.pyx fmpz.pyx nmod_series.pyx
arb.pyx fmpq_poly.pyx fmpz_series.pyx __pycache__ Some files e.g. |
c94f436
to
1094125
Compare
1094125
to
a3b6bc8
Compare
With the latest cython from git it doesn't seem necessary to patch cython to get the coverage report to work but there are some problems: Building There are several build warnings from cython:
The tests fail immediately with
|
I get the same results with the prerelease Also I noticed another warning:
|
The test failure is due to this change in cython:
I guess |
Work in progress to add coverage testing.
Currently requires a patch to cython due to the use of
include
although that wouldn't be needed if #15 was fixed.Current coverage report:
Note that that does not include files that have literally zero coverage: