40
40
from scipy .special import ellipe , ellipk , ellipkm1
41
41
from scipy .special import elliprc , elliprd , elliprf , elliprg , elliprj
42
42
from scipy .special import mathieu_odd_coef , mathieu_even_coef , stirling2
43
- from scipy ._lib .deprecation import _NoValue
44
43
from scipy ._lib ._util import np_long , np_ulong
45
44
46
45
from scipy .special ._basic import _FACTORIALK_LIMITS_64BITS , \
@@ -1429,8 +1428,8 @@ def test_betainc_domain_errors(self, func, args):
1429
1428
1430
1429
class TestCombinatorics :
1431
1430
def test_comb (self ):
1432
- assert_array_almost_equal (special .comb ([10 , 10 ], [3 , 4 ]), [120. , 210. ])
1433
- assert_almost_equal (special .comb (10 , 3 ), 120. )
1431
+ assert_allclose (special .comb ([10 , 10 ], [3 , 4 ]), [120. , 210. ])
1432
+ assert_allclose (special .comb (10 , 3 ), 120. )
1434
1433
assert_equal (special .comb (10 , 3 , exact = True ), 120 )
1435
1434
assert_equal (special .comb (10 , 3 , exact = True , repetition = True ), 220 )
1436
1435
@@ -1443,39 +1442,6 @@ def test_comb(self):
1443
1442
expected = 100891344545564193334812497256
1444
1443
assert special .comb (100 , 50 , exact = True ) == expected
1445
1444
1446
- @pytest .mark .parametrize ("repetition" , [True , False ])
1447
- @pytest .mark .parametrize ("legacy" , [True , False , _NoValue ])
1448
- @pytest .mark .parametrize ("k" , [3.5 , 3 ])
1449
- @pytest .mark .parametrize ("N" , [4.5 , 4 ])
1450
- def test_comb_legacy (self , N , k , legacy , repetition ):
1451
- # test is only relevant for exact=True
1452
- if legacy is not _NoValue :
1453
- with pytest .warns (
1454
- DeprecationWarning ,
1455
- match = r"Using 'legacy' keyword is deprecated"
1456
- ):
1457
- result = special .comb (N , k , exact = True , legacy = legacy ,
1458
- repetition = repetition )
1459
- else :
1460
- result = special .comb (N , k , exact = True , legacy = legacy ,
1461
- repetition = repetition )
1462
- if legacy :
1463
- # for exact=True and legacy=True, cast input arguments, else don't
1464
- if repetition :
1465
- # the casting in legacy mode happens AFTER transforming N & k,
1466
- # so rounding can change (e.g. both floats, but sum to int);
1467
- # hence we need to emulate the repetition-transformation here
1468
- N , k = int (N + k - 1 ), int (k )
1469
- repetition = False
1470
- else :
1471
- N , k = int (N ), int (k )
1472
- # expected result is the same as with exact=False
1473
- with suppress_warnings () as sup :
1474
- if legacy is not _NoValue :
1475
- sup .filter (DeprecationWarning )
1476
- expected = special .comb (N , k , legacy = legacy , repetition = repetition )
1477
- assert_equal (result , expected )
1478
-
1479
1445
def test_comb_with_np_int64 (self ):
1480
1446
n = 70
1481
1447
k = 30
@@ -1490,11 +1456,10 @@ def test_comb_zeros(self):
1490
1456
assert_equal (special .comb (- 1 , 3 , exact = True ), 0 )
1491
1457
assert_equal (special .comb (2 , - 1 , exact = True ), 0 )
1492
1458
assert_equal (special .comb (2 , - 1 , exact = False ), 0 )
1493
- assert_array_almost_equal (special .comb ([2 , - 1 , 2 , 10 ], [3 , 3 , - 1 , 3 ]),
1494
- [0. , 0. , 0. , 120. ])
1459
+ assert_allclose (special .comb ([2 , - 1 , 2 , 10 ], [3 , 3 , - 1 , 3 ]), [0. , 0. , 0. , 120. ])
1495
1460
1496
1461
def test_perm (self ):
1497
- assert_array_almost_equal (special .perm ([10 , 10 ], [3 , 4 ]), [720. , 5040. ])
1462
+ assert_allclose (special .perm ([10 , 10 ], [3 , 4 ]), [720. , 5040. ])
1498
1463
assert_almost_equal (special .perm (10 , 3 ), 720. )
1499
1464
assert_equal (special .perm (10 , 3 , exact = True ), 720 )
1500
1465
@@ -1503,14 +1468,8 @@ def test_perm_zeros(self):
1503
1468
assert_equal (special .perm (- 1 , 3 , exact = True ), 0 )
1504
1469
assert_equal (special .perm (2 , - 1 , exact = True ), 0 )
1505
1470
assert_equal (special .perm (2 , - 1 , exact = False ), 0 )
1506
- assert_array_almost_equal (special .perm ([2 , - 1 , 2 , 10 ], [3 , 3 , - 1 , 3 ]),
1507
- [0. , 0. , 0. , 720. ])
1508
-
1509
- def test_positional_deprecation (self ):
1510
- with pytest .deprecated_call (match = "use keyword arguments" ):
1511
- # from test_comb
1512
- special .comb ([10 , 10 ], [3 , 4 ], False , False )
1513
-
1471
+ assert_allclose (special .perm ([2 , - 1 , 2 , 10 ], [3 , 3 , - 1 , 3 ]), [0. , 0. , 0. , 720. ])
1472
+
1514
1473
1515
1474
class TestTrigonometric :
1516
1475
def test_cbrt (self ):
0 commit comments