@@ -980,6 +980,7 @@ def test_negative(self):
980
980
assert_equal (binary_repr (- 1 ), '-1' )
981
981
assert_equal (binary_repr (- 1 , width = 8 ), '11111111' )
982
982
983
+
983
984
class TestBaseRepr (TestCase ):
984
985
def test_base3 (self ):
985
986
assert_equal (base_repr (3 ** 5 , 3 ), '100000' )
@@ -1946,7 +1947,7 @@ def test_filled_like(self):
1946
1947
self .check_like_function (np .full_like , 123.456 , True )
1947
1948
self .check_like_function (np .full_like , np .inf , True )
1948
1949
1949
- class _TestCorrelate (TestCase ):
1950
+ class TestCorrelate (TestCase ):
1950
1951
def _setup (self , dt ):
1951
1952
self .x = np .array ([1 , 2 , 3 , 4 , 5 ], dtype = dt )
1952
1953
self .xs = np .arange (1 , 20 )[::3 ]
@@ -1961,24 +1962,24 @@ def _setup(self, dt):
1961
1962
1962
1963
def test_float (self ):
1963
1964
self ._setup (np .float )
1964
- z = np .correlate (self .x , self .y , 'full' , old_behavior = self . old_behavior )
1965
+ z = np .correlate (self .x , self .y , 'full' )
1965
1966
assert_array_almost_equal (z , self .z1 )
1966
- z = np .correlate (self .x , self .y [:- 1 ], 'full' , old_behavior = self . old_behavior )
1967
+ z = np .correlate (self .x , self .y [:- 1 ], 'full' )
1967
1968
assert_array_almost_equal (z , self .z1_4 )
1968
- z = np .correlate (self .y , self .x , 'full' , old_behavior = self . old_behavior )
1969
+ z = np .correlate (self .y , self .x , 'full' )
1969
1970
assert_array_almost_equal (z , self .z2 )
1970
- z = np .correlate (self .x [::- 1 ], self .y , 'full' , old_behavior = self . old_behavior )
1971
+ z = np .correlate (self .x [::- 1 ], self .y , 'full' )
1971
1972
assert_array_almost_equal (z , self .z1r )
1972
- z = np .correlate (self .y , self .x [::- 1 ], 'full' , old_behavior = self . old_behavior )
1973
+ z = np .correlate (self .y , self .x [::- 1 ], 'full' )
1973
1974
assert_array_almost_equal (z , self .z2r )
1974
- z = np .correlate (self .xs , self .y , 'full' , old_behavior = self . old_behavior )
F438
code>
1975
+ z = np .correlate (self .xs , self .y , 'full' )
1975
1976
assert_array_almost_equal (z , self .zs )
1976
1977
1977
1978
def test_object (self ):
1978
1979
self ._setup (Decimal )
1979
- z = np .correlate (self .x , self .y , 'full' , old_behavior = self . old_behavior )
1980
+ z = np .correlate (self .x , self .y , 'full' )
1980
1981
assert_array_almost_equal (z , self .z1 )
1981
- z = np .correlate (self .y , self .x , 'full' , old_behavior = self . old_behavior )
1982
+ z = np .correlate (self .y , self .x , 'full' )
1982
1983
assert_array_almost_equal (z , self .z2 )
1983
1984
1984
1985
def test_no_overwrite (self ):
@@ -1988,45 +1989,15 @@ def test_no_overwrite(self):
1988
1989
assert_array_equal (d , np .ones (100 ))
1989
1990
assert_array_equal (k , np .ones (3 ))
1990
1991
1991
- class TestCorrelate (_TestCorrelate ):
1992
- old_behavior = True
1993
- def _setup (self , dt ):
1994
- # correlate uses an unconventional definition so that correlate(a, b)
1995
- # == correlate(b, a), so force the corresponding outputs to be the same
1996
- # as well
1997
- _TestCorrelate ._setup (self , dt )
1998
- self .z2 = self .z1
1999
- self .z2r = self .z1r
2000
-
2001
- @dec .deprecated ()
2002
- def test_complex (self ):
2003
- x = np .array ([1 , 2 , 3 , 4 + 1j ], dtype = np .complex )
2004
- y = np .array ([- 1 , - 2j , 3 + 1j ], dtype = np .complex )
2005
- r_z = np .array ([3 + 1j , 6 , 8 - 1j , 9 + 1j , - 1 - 8j , - 4 - 1j ], dtype = np .complex )
2006
- z = np .correlate (x , y , 'full' , old_behavior = self .old_behavior )
2007
- assert_array_almost_equal (z , r_z )
2008
-
2009
- @dec .deprecated ()
2010
- def test_float (self ):
2011
- _TestCorrelate .test_float (self )
2012
-
2013
- @dec .deprecated ()
2014
- def test_object (self ):
2015
- _TestCorrelate .test_object (self )
2016
-
2017
- class TestCorrelateNew (_TestCorrelate ):
2018
- old_behavior = False
2019
1992
def test_complex (self ):
2020
1993
x = np .array ([1 , 2 , 3 , 4 + 1j ], dtype = np .complex )
2021
1994
y = np .array ([- 1 , - 2j , 3 + 1j ], dtype = np .complex )
2022
1995
r_z = np .array ([3 - 1j , 6 , 8 + 1j , 11 + 5j , - 5 + 8j , - 4 - 1j ], dtype = np .complex )
2023
- #z = np.acorrelate(x, y, 'full')
2024
- #assert_array_almost_equal(z, r_z)
2025
-
2026
1996
r_z = r_z [::- 1 ].conjugate ()
2027
- z = np . correlate (y , x , 'full' , old_behavior = self . old_behavior )
1997
+ z = correlate (y , x , mode = 'full' )
2028
1998
assert_array_almost_equal (z , r_z )
2029
1999
2000
+
2030
2001
class TestConvolve (TestCase ):
2031
2002
def test_object (self ):
2032
2003
d = [1. ] * 100
0 commit comments