Skip to content

Tests are broken with scipy 1.16.0 #83

@Tommimon

Description

@Tommimon

I tried to run the tests but 2 of them fail with a version of scipy greater or equal to 1.16.0 with the following log:

FAIL: test_82 (numerical.specialfunctions.TestNumericalSpecialFunctions.test_82)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/root/ModularCalculator/tests/testrunner.py", line 66, in do_test
    raise err
  File "/root/ModularCalculator/tests/testrunner.py", line 29, in do_test
    self.assertEqual(actual, expected, msg=expr)
AssertionError: Number('5945711222452133', '4503599627370496') != Number('1486427805088563', '1125899906842624') : sp_nctdtrit(1, 1, 0.5)

======================================================================
FAIL: test_87 (numerical.specialfunctions.TestNumericalSpecialFunctions.test_87)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/root/ModularCalculator/tests/testrunner.py", line 66, in do_test
    raise err
  File "/root/ModularCalculator/tests/testrunner.py", line 29, in do_test
    self.assertEqual(actual, expected, msg=expr)
AssertionError: Number('-1661586938413673', '4503599627370496') != Number('-6646347753654691', '18014398509481984') : sp_log_ndtr(0.5)

----------------------------------------------------------------------

I was running this test in an Ubuntu container but I tried also other distros with the same result.
The problem seams that scipy changed something in how these functions are calculated because I get slightly different results with different versions:

Python 3.12.3 (main, Nov  6 2025, 13:44:16) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import scipy
>>> scipy.__version__
'1.15.3'
>>> print(scipy.special.nctdtrit(1,1,0.5))
1.3202130989218857
>>> 


Python 3.12.3 (main, Nov  6 2025, 13:44:16) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import scipy
>>> scipy.__version__
'1.16.0'
>>> print(scipy.special.nctdtrit(1,1,0.5))
1.3202130993877088
>>> 

I think the best approach to solve this is to add a condition in the tests and if a version of scipy grater than 1.16.0 is detected, the new values should be used:

  • Number('5945711222452133', '4503599627370496') for sp_nctdtrit(1, 1, 0.5)
  • Number('-1661586938413673', '4503599627370496') for sp_log_ndtr(0.5)

Let me know if you can reproduce the same issue and if I can help to get the tests to work also with newer versions of scipy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions