Test failed using mpmath.runtests()

I run the following code in Spyder IDE (Python 3.8):

import mpmath
mpmath.runtests()

I think that most of the tests passed, but I get ‘Test failed’. Attached part of the output:

test_pickle
    pickle                    ok        0.0648950 s
test_power
    fractional_pow            ok        0.0007822 s
    pow_epsilon_rounding      ok        0.0103981 s
    pow_integer_direction     ok        0.0193535 s
test_quad
    basic_integrals           ok        1.1562272 s
    complex_integration       ok        0.0056852 s
    double_1                  ok        0.3558573 s
    double_2                  ok        0.4513715 s
    double_3                  ok        0.6033714 s
    double_4                  ok        0.1894437 s
    double_5                  ok        0.1238344 s
    double_6                  ok        0.7316320 s
    double_7                  ok        5.4023527 s
    double_trivial            ok        0.0566362 s
    expmath_fail              
TEST FAILED!

ok        0.0425350 s
    expmath_integrals         Traceback (most recent call last):
  File "C:UserseliiAnaconda3envsmpmath_gmpy2_envlibsite-packagesmpmathtestsruntests.py", line 118, in testit
    module.__dict__[f]()
  File "C:UserseliiAnaconda3envsmpmath_gmpy2_envlibsite-packagesmpmathteststest_quad.py", line 88, in test_expmath_fail
    assert ae(quadts(lambda x: sqrt(tan(x)), [0, pi/2]),          pi*sqrt(2)/2)
AssertionError
ok        0.8399490 s
    quad_infinite_mirror      ok        0.0250090 s
    quad_symmetry             ok        0.0008955 s
    quadgl_linear             ok        0.0001940 s
    quadosc                   ok        0.2904317 s
test_rootfinding
    anewton                   ok        0.0040029 s
    bisection                 ok        0.0002888 s
    findroot                  ok        0.0401497 s
    mnewton                   ok        0.0014225 s
    muller                    ok        0.0079640 s
    multidimensional          ok        0.0322137 s
    multiplicity              ok        0.0027796 s
    trivial                   ok        0.0001189 s
test_special
    convert_special           ok        0.0013397 s
    div_bug                   ok        0.0000584 s
    functions_special         ok        0.0002212 s
    special                   ok        0.0005193 s
    special_powers            ok        0.0000920 s
test_str
    nstr                      ok        0.0011065 s
test_summation
    fprod                     ok        0.0000991 s
    fsum                      ok        0.0009620 s
    nprod                     ok        0.0187528 s
    nsum                      ok        0.1046476 s
    sumem                     ok        0.0756396 s
test_trig
    trig_misc_hard            ok        0.0016346 s
    trig_near_n_pi            ok        0.0031282 s
    trig_near_zero            ok        0.0006552 s
test_visualization
    axes                      
Skipping test (pylab not available or too old version)

ok        0.0048888 s

finished tests in 132.72 seconds

I tried searching the internet for what the problem might be, but unfortunately I did not find one. Does anyone know what the failure of the test is due to and what can be done to solve this problem?

Note: I worked on an Anaconda environment.

Thank you!

Answer

Tests decorated with @pytest.mark.xfail are expected to fail (see documentation), which is the case for this particular test. This can be used by the author(s) to document known limits/bugs and later used to test fixes.

Leave a Reply

Your email address will not be published. Required fields are marked *