Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 12b5922

Browse files
authoredFeb 6, 2023
Merge pull request #45 from Quansight-Labs/rm_timedelta_etc
TST: trim tests of unsupported numpy features
2 parents 3a37806 + 3ff5b3b commit 12b5922

File tree

4 files changed

+22
-241
lines changed

4 files changed

+22
-241
lines changed
 

‎torch_np/tests/numpy_tests/core/test_numeric.py

Lines changed: 3 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -750,19 +750,15 @@ def check_promotion_cases(self, promote_func):
750750
b = np.bool_(0)
751751
i8, i16, i32, i64 = np.int8(0), np.int16(0), np.int32(0), np.int64(0)
752752
u8 = np.uint8(0)
753-
f32, f64, fld = np.float32(0), np.float64(0), np.longdouble(0)
754-
c64, c128, cld = np.complex64(0), np.complex128(0), np.clongdouble(0)
753+
f32, f64 = np.float32(0), np.float64(0)
754+
c64, c128 = np.complex64(0), np.complex128(0)
755755

756756
# coercion within the same kind
757757
assert_equal(promote_func(i8, i16), np.dtype(np.int16))
758758
assert_equal(promote_func(i32, i8), np.dtype(np.int32))
759759
assert_equal(promote_func(i16, i64), np.dtype(np.int64))
760760
assert_equal(promote_func(f32, f64), np.dtype(np.float64))
761-
assert_equal(promote_func(fld, f32), np.dtype(np.longdouble))
762-
assert_equal(promote_func(f64, fld), np.dtype(np.longdouble))
763761
assert_equal(promote_func(c128, c64), np.dtype(np.complex128))
764-
assert_equal(promote_func(cld, c128), np.dtype(np.clongdouble))
765-
assert_equal(promote_func(c64, fld), np.dtype(np.clongdouble))
766762

767763
# coercion between kinds
768764
assert_equal(promote_func(b, i32), np.dtype(np.int32))
@@ -777,7 +773,6 @@ def check_promotion_cases(self, promote_func):
777773
assert_equal(promote_func(f32, u32), np.dtype(np.float64))
778774
assert_equal(promote_func(f32, c64), np.dtype(np.complex64))
779775
assert_equal(promote_func(c128, f32), np.dtype(np.complex128))
780-
assert_equal(promote_func(cld, f64), np.dtype(np.clongdouble))
781776

782777
# coercion between scalars and 1-D arrays
783778
assert_equal(promote_func(np.array([b]), i8), np.dtype(np.int8))
@@ -822,9 +817,6 @@ def res_type(a, b):
822817
for a in [np.array([True, False]), np.array([-3, 12], dtype=np.int8)]:
823818
b = 1.234 * a
824819
assert_equal(b.dtype, np.dtype('f8'), "array type %s" % a.dtype)
825-
b = np.longdouble(1.234) * a
826-
assert_equal(b.dtype, np.dtype(np.longdouble),
827-
"array type %s" % a.dtype)
828820
b = np.float64(1.234) * a
829821
assert_equal(b.dtype, np.dtype('f8'), "array type %s" % a.dtype)
830822
b = np.float32(1.234) * a
@@ -834,9 +826,6 @@ def res_type(a, b):
834826

835827
b = 1.234j * a
836828
assert_equal(b.dtype, np.dtype('c16'), "array type %s" % a.dtype)
837-
b = np.clongdouble(1.234j) * a
838-
assert_equal(b.dtype, np.dtype(np.clongdouble),
839-
"array type %s" % a.dtype)
840829
b = np.complex128(1.234j) * a
841830
assert_equal(b.dtype, np.dtype('c16'), "array type %s" % a.dtype)
842831
b = np.complex64(1.234j) * a
@@ -1097,41 +1086,6 @@ def test_can_cast(self):
10971086
# Also test keyword arguments
10981087
assert_(np.can_cast(from_=np.int32, to=np.int64))
10991088

1100-
def test_can_cast_simple_to_structured(self):
1101-
# Non-structured can only be cast to structured in 'unsafe' mode.
1102-
assert_(not np.can_cast('i4', 'i4,i4'))
1103-
assert_(not np.can_cast('i4', 'i4,i2'))
1104-
assert_(np.can_cast('i4', 'i4,i4', casting='unsafe'))
1105-
assert_(np.can_cast('i4', 'i4,i2', casting='unsafe'))
1106-
# Even if there is just a single field which is OK.
1107-
assert_(not np.can_cast('i2', [('f1', 'i4')]))
1108-
assert_(not np.can_cast('i2', [('f1', 'i4')], casting='same_kind'))
1109-
assert_(np.can_cast('i2', [('f1', 'i4')], casting='unsafe'))
1110-
# It should be the same for recursive structured or subarrays.
1111-
assert_(not np.can_cast('i2', [('f1', 'i4,i4')]))
1112-
assert_(np.can_cast('i2', [('f1', 'i4,i4')], casting='unsafe'))
1113-
assert_(not np.can_cast('i2', [('f1', '(2,3)i4')]))
1114-
assert_(np.can_cast('i2', [('f1', '(2,3)i4')], casting='unsafe'))
1115-
1116-
def test_can_cast_structured_to_simple(self):
1117-
# Need unsafe casting for structured to simple.
1118-
assert_(not np.can_cast([('f1', 'i4')], 'i4'))
1119-
assert_(np.can_cast([('f1', 'i4')], 'i4', casting='unsafe'))
1120-
assert_(np.can_cast([('f1', 'i4')], 'i2', casting='unsafe'))
1121-
# Since it is unclear what is being cast, multiple fields to
1122-
# single should not work even for unsafe casting.
1123-
assert_(not np.can_cast('i4,i4', 'i4', casting='unsafe'))
1124-
# But a single field inside a single field is OK.
1125-
assert_(not np.can_cast([('f1', [('x', 'i4')])], 'i4'))
1126-
assert_(np.can_cast([('f1', [('x', 'i4')])], 'i4', casting='unsafe'))
1127-
# And a subarray is fine too - it will just take the first element
1128-
# (arguably not very consistently; might also take the first field).
1129-
assert_(not np.can_cast([('f0', '(3,)i4')], 'i4'))
1130-
assert_(np.can_cast([('f0', '(3,)i4')], 'i4', casting='unsafe'))
1131-
# But a structured subarray with multiple fields should fail.
1132-
assert_(not np.can_cast([('f0', ('i4,i4'), (2,))], 'i4',
1133-
casting='unsafe'))
1134-
11351089
def test_can_cast_values(self):
11361090
# gh-5917
11371091
for dt in np.sctypes['int'] + np.sctypes['uint']:
@@ -1189,7 +1143,7 @@ def load_data(self, n, eindex):
11891143
raise NIterError('error at index %s' % eindex)
11901144
yield e
11911145

1192-
@pytest.mark.parametrize("dtype", [int, object])
1146+
@pytest.mark.parametrize("dtype", [int])
11931147
@pytest.mark.parametrize(["count", "error_index"], [(10, 5), (10, 9)])
11941148
def test_2592(self, count, error_index, dtype):
11951149
# Test iteration exceptions are correctly raised. The data/generator
@@ -1198,40 +1152,6 @@ def test_2592(self, count, error_index, dtype):
11981152
with pytest.raises(NIterError):
11991153
np.fromiter(iterable, dtype=dtype, count=count)
12001154

1201-
@pytest.mark.parametrize("dtype", ["S", "S0", "V0", "U0"])
1202-
def test_empty_not_structured(self, dtype):
1203-
# Note, "S0" could be allowed at some point, so long "S" (without
1204-
# any length) is rejected.
1205-
with pytest.raises(ValueError, match="Must specify length"):
1206-
np.fromiter([], dtype=dtype)
1207-
1208-
@pytest.mark.parametrize(["dtype", "data"],
1209-
[("d", [1, 2, 3, 4, 5, 6, 7, 8, 9]),
1210-
("O", [1, 2, 3, 4, 5, 6, 7, 8, 9]),
1211-
("i,O", [(1, 2), (5, 4), (2, 3), (9, 8), (6, 7)]),
1212-
# subarray dtypes (important because their dimensions end up
1213-
# in the result arrays dimension:
1214-
("2i", [(1, 2), (5, 4), (2, 3), (9, 8), (6, 7)]),
1215-
])
1216-
@pytest.mark.parametrize("length_hint", [0, 1])
1217-
def test_growth_and_complicated_dtypes(self, dtype, data, length_hint):
1218-
dtype = np.dtype(dtype)
1219-
1220-
data = data * 100 # make sure we realloc a bit
1221-
1222-
class MyIter:
1223-
# Class/example from gh-15789
1224-
def __length_hint__(self):
1225-
# only required to be an estimate, this is legal
1226-
return length_hint # 0 or 1
1227-
1228-
def __iter__(self):
1229-
return iter(data)
1230-
1231-
res = np.fromiter(MyIter(), dtype=dtype)
1232-
expected = np.array(data, dtype=dtype)
1233-
1234-
assert_array_equal(res, expected)
12351155

12361156
def test_empty_result(self):
12371157
class MyIter:

‎torch_np/tests/numpy_tests/lib/test_function_base.py

Lines changed: 7 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -741,18 +741,6 @@ def test_n(self):
741741
assert_equal(out.dtype, np.int_)
742742
assert_equal(len(out), max(0, len(x) - n))
743743

744-
def test_times(self):
745-
x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64)
746-
expected = [
747-
np.array([1, 1], dtype='timedelta64[D]'),
748-
np.array([0], dtype='timedelta64[D]'),
749-
]
750-
expected.extend([np.array([], dtype='timedelta64[D]')] * 3)
751-
for n, exp in enumerate(expected, start=1):
752-
out = diff(x, n=n)
753-
assert_array_equal(out, exp)
754-
assert_equal(out.dtype, exp.dtype)
755-
756744
def test_prepend(self):
757745
x = np.arange(5) + 1
758746
assert_array_equal(diff(x, prepend=0), np.ones(5))
@@ -1068,17 +1056,6 @@ def test_specific_axes(self):
10681056
assert_raises(np.AxisError, gradient, x, axis=-3)
10691057
# assert_raises(TypeError, gradient, x, axis=[1,])
10701058

1071-
def test_timedelta64(self):
1072-
# Make sure gradient() can handle special types like timedelta64
1073-
x = np.array(
1074-
[-5, -3, 10, 12, 61, 321, 300],
1075-
dtype='timedelta64[D]')
1076-
dx = np.array(
1077-
[2, 7, 7, 25, 154, 119, -21],
1078-
dtype='timedelta64[D]')
1079-
assert_array_equal(gradient(x), dx)
1080-
assert_(dx.dtype == np.dtype('timedelta64[D]'))
1081-
10821059
def test_inexact_dtypes(self):
10831060
for dt in [np.float16, np.float32, np.float64]:
10841061
# dtypes should not be promoted in a different way to what diff does
@@ -1620,26 +1597,6 @@ def test_size_zero_output(self):
16201597
with assert_raises_regex(ValueError, 'new output dimensions'):
16211598
f(x)
16221599

1623-
def test_subclasses(self):
1624-
class subclass(np.ndarray):
1625-
pass
1626-
1627-
m = np.array([[1., 0., 0.],
1628-
[0., 0., 1.],
1629-
[0., 1., 0.]]).view(subclass)
1630-
v = np.array([[1., 2., 3.], [4., 5., 6.], [7., 8., 9.]]).view(subclass)
1631-
# generalized (gufunc)
1632-
matvec = np.vectorize(np.matmul, signature='(m,m),(m)->(m)')
1633-
r = matvec(m, v)
1634-
assert_equal(type(r), subclass)
1635-
assert_equal(r, [[1., 3., 2.], [4., 6., 5.], [7., 9., 8.]])
1636-
1637-
# element-wise (ufunc)
1638-
mult = np.vectorize(lambda x, y: x*y)
1639-
r = mult(m, v)
1640-
assert_equal(type(r), subclass)
1641-
assert_equal(r, m * v)
1642-
16431600

16441601
@pytest.mark.xfail(reason='TODO: implement')
16451602
class TestDigitize:
@@ -1705,15 +1662,6 @@ def test_casting_error(self):
17051662
x, bins = bins, x
17061663
assert_raises(TypeError, digitize, x, bins)
17071664

1708-
def test_return_type(self):
1709-
# Functions returning indices should always return base ndarrays
1710-
class A(np.ndarray):
1711-
pass
1712-
a = np.arange(5).view(A)
1713-
b = np.arange(1, 3).view(A)
1714-
assert_(not isinstance(digitize(b, a, False), A))
1715-
assert_(not isinstance(digitize(b, a, True), A))
1716-
17171665
def test_large_integers_increasing(self):
17181666
# gh-11022
17191667
x = 2**54 # loses precision in a float
@@ -1757,7 +1705,7 @@ def test_period(self):
17571705

17581706
@pytest.mark.xfail(reason='TODO: implement')
17591707
@pytest.mark.parametrize(
1760-
"dtype", "O" + np.typecodes["AllInteger"] + np.typecodes["Float"]
1708+
"dtype", np.typecodes["AllInteger"] + np.typecodes["Float"]
17611709
)
17621710
@pytest.mark.parametrize("M", [0, 1, 10])
17631711
class TestFilterwindows:
@@ -1766,10 +1714,7 @@ def test_hanning(self, dtype: str, M: int) -> None:
17661714
scalar = np.array(M, dtype=dtype)[()]
17671715

17681716
w = hanning(scalar)
1769-
if dtype == "O":
1770-
ref_dtype = np.float64
1771-
else:
1772-
ref_dtype = np.result_type(scalar.dtype, np.float64)
1717+
ref_dtype = np.result_type(scalar.dtype, np.float64)
17731718
assert w.dtype == ref_dtype
17741719

17751720
# check symmetry
@@ -1787,10 +1732,7 @@ def test_hamming(self, dtype: str, M: int) -> None:
17871732
scalar = np.array(M, dtype=dtype)[()]
17881733

17891734
w = hamming(scalar)
1790-
if dtype == "O":
1791-
ref_dtype = np.float64
1792-
else:
1793-
ref_dtype = np.result_type(scalar.dtype, np.float64)
1735+
ref_dtype = np.result_type(scalar.dtype, np.float64)
17941736
assert w.dtype == ref_dtype
17951737

17961738
# check symmetry
@@ -1808,10 +1750,7 @@ def test_bartlett(self, dtype: str, M: int) -> None:
18081750
scalar = np.array(M, dtype=dtype)[()]
18091751

18101752
w = bartlett(scalar)
1811-
if dtype == "O":
1812-
ref_dtype = np.float64
1813-
else:
1814-
ref_dtype = np.result_type(scalar.dtype, np.float64)
1753+
ref_dtype = np.result_type(scalar.dtype, np.float64)
18151754
assert w.dtype == ref_dtype
18161755

18171756
# check symmetry
@@ -1829,10 +1768,7 @@ def test_blackman(self, dtype: str, M: int) -> None:
18291768
scalar = np.array(M, dtype=dtype)[()]
18301769

18311770
w = blackman(scalar)
1832-
if dtype == "O":
1833-
ref_dtype = np.float64
1834-
else:
1835-
ref_dtype = np.result_type(scalar.dtype, np.float64)
1771+
ref_dtype = np.result_type(scalar.dtype, np.float64)
18361772
assert w.dtype == ref_dtype
18371773

18381774
# check symmetry
@@ -1850,10 +1786,7 @@ def test_kaiser(self, dtype: str, M: int) -> None:
18501786
scalar = np.array(M, dtype=dtype)[()]
18511787

18521788
w = kaiser(scalar, 0)
1853-
if dtype == "O":
1854-
ref_dtype = np.float64
1855-
else:
1856-
ref_dtype = np.result_type(scalar.dtype, np.float64)
1789+
ref_dtype = np.result_type(scalar.dtype, np.float64)
18571790
assert w.dtype == ref_dtype
18581791

18591792
# check symmetry
@@ -2438,14 +2371,6 @@ def test_multidimensional_extrafunc(self):
24382371
assert_array_equal(y, np.array([[-1., -1., -1.],
24392372
[3., 3., 1.]]))
24402373

2441-
def test_subclasses(self):
2442-
class subclass(np.ndarray):
2443-
pass
2444-
x = np.arange(5.).view(subclass)
2445-
r = piecewise(x, [x<2., x>=4], [-1., 1., 0.])
2446-
assert_equal(type(r), subclass)
2447-
assert_equal(r, [-1., -1., 0., 0., 1.])
2448-
24492374

24502375
class TestBincount:
24512376

@@ -2840,10 +2765,7 @@ def test_linear_interpolation(self,
28402765
actual, expected_dtype.type(expected), 14)
28412766

28422767
if method in ["inverted_cdf", "closest_observation"]:
2843-
if input_dtype == "O":
2844-
np.testing.assert_equal(np.asarray(actual).dtype, np.float64)
2845-
else:
2846-
np.testing.assert_equal(np.asarray(actual).dtype,
2768+
np.testing.assert_equal(np.asarray(actual).dtype,
28472769
np.dtype(input_dtype))
28482770
else:
28492771
np.testing.assert_equal(np.asarray(actual).dtype,

‎torch_np/tests/numpy_tests/lib/test_nanfunctions.py

Lines changed: 12 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def test_out(self):
192192
assert_almost_equal(res, tgt)
193193

194194
def test_dtype_from_input(self):
195-
codes = 'efdgFDG'
195+
codes = 'efdFD'
196196
for nf, rf in zip(self.nanfuncs, self.stdfuncs):
197197
for c in codes:
198198
mat = np.eye(3, dtype=c)
@@ -285,18 +285,6 @@ class MyNDArray(np.ndarray):
285285
assert_(res != np.nan)
286286
assert_(len(w) == 0)
287287

288-
def test_object_array(self):
289-
arr = np.array([[1.0, 2.0], [np.nan, 4.0], [np.nan, np.nan]], dtype=object)
290-
assert_equal(np.nanmin(arr), 1.0)
291-
assert_equal(np.nanmin(arr, axis=0), [1.0, 2.0])
292-
293-
with warnings.catch_warnings(record=True) as w:
294-
warnings.simplefilter('always')
295-
# assert_equal does not work on object arrays of nan
296-
assert_equal(list(np.nanmin(arr, axis=1)), [1.0, 4.0, np.nan])
297-
assert_(len(w) == 1, 'no warning raised')
298-
assert_(issubclass(w[0].category, RuntimeWarning))
299-
300288
@pytest.mark.parametrize("dtype", np.typecodes["AllFloat"])
301289
def test_initial(self, dtype):
302290
class MyNDArray(np.ndarray):
@@ -444,7 +432,7 @@ def test_out(self, dtype):
444432
@pytest.mark.xfail(reason='TODO: implement')
445433
@pytest.mark.parametrize(
446434
"dtype",
447-
np.typecodes["AllInteger"] + np.typecodes["AllFloat"] + "O",
435+
np.typecodes["AllInteger"] + np.typecodes["AllFloat"]
448436
)
449437
@pytest.mark.parametrize("mat", _TEST_ARRAYS.values(), ids=_TEST_ARRAYS.keys())
450438
class TestNanFunctions_NumberTypes:
@@ -491,10 +479,7 @@ def test_nanfunc_q(self, mat, dtype, nanfunc, func):
491479

492480
assert_almost_equal(out, tgt)
493481

494-
if dtype == "O":
495-
assert type(out) is type(tgt)
496-
else:
497-
assert out.dtype == tgt.dtype
482+
assert out.dtype == tgt.dtype
498483

499484
@pytest.mark.parametrize(
500485
"nanfunc,func",
@@ -507,10 +492,7 @@ def test_nanfunc_ddof(self, mat, dtype, nanfunc, func):
507492
out = nanfunc(mat, ddof=0.5)
508493

509494
assert_almost_equal(out, tgt)
510-
if dtype == "O":
511-
assert type(out) is type(tgt)
512-
else:
513-
assert out.dtype == tgt.dtype
495+
assert out.dtype == tgt.dtype
514496

515497

516498
class SharedNanFunctionsTestsMixin:
@@ -540,11 +522,11 @@ def test_out(self):
540522

541523
def test_dtype_from_dtype(self):
542524
mat = np.eye(3)
543-
codes = 'efdgFDG'
525+
codes = 'efdFD'
544526
for nf, rf in zip(self.nanfuncs, self.stdfuncs):
545527
for c in codes:
546528
with suppress_warnings() as sup:
547-
if nf in {np.nanstd, np.nanvar} and c in 'FDG':
529+
if nf in {np.nanstd, np.nanvar} and c in 'FD':
548530
# Giving the warning is a small bug, see gh-8000
549531
sup.filter(np.ComplexWarning)
550532
tgt = rf(mat, dtype=np.dtype(c), axis=1).dtype.type
@@ -557,11 +539,11 @@ def test_dtype_from_dtype(self):
557539

558540
def test_dtype_from_char(self):
559541
mat = np.eye(3)
560-
codes = 'efdgFDG'
542+
codes = 'efdFD'
561543
for nf, rf in zip(self.nanfuncs, self.stdfuncs):
562544
for c in codes:
563545
with suppress_warnings() as sup:
564-
if nf in {np.nanstd, np.nanvar} and c in 'FDG':
546+
if nf in {np.nanstd, np.nanvar} and c in 'FD':
565547
# Giving the warning is a small bug, see gh-8000
566548
sup.filter(np.ComplexWarning)
567549
tgt = rf(mat, dtype=c, axis=1).dtype.type
@@ -573,7 +555,7 @@ def test_dtype_from_char(self):
573555
assert_(res is tgt)
574556

575557
def test_dtype_from_input(self):
576-
codes = 'efdgFDG'
558+
codes = 'efdFD'
577559
for nf, rf in zip(self.nanfuncs, self.stdfuncs):
578560
for c in codes:
579561
mat = np.eye(3, dtype=c)
@@ -760,12 +742,12 @@ class TestNanFunctions_MeanVarStd(SharedNanFunctionsTestsMixin):
760742

761743
def test_dtype_error(self):
762744
for f in self.nanfuncs:
763-
for dtype in [np.bool_, np.int_, np.object_]:
745+
for dtype in [np.bool_, np.int_]:
764746
assert_raises(TypeError, f, _ndat, axis=1, dtype=dtype)
765747

766748
def test_out_dtype_error(self):
767749
for f in self.nanfuncs:
768-
for dtype in [np.bool_, np.int_, np.object_]:
750+
for dtype in [np.bool_, np.int_]:
769751
out = np.empty(_ndat.shape[0], dtype=dtype)
770752
assert_raises(TypeError, f, _ndat, axis=1, out=out)
771753

@@ -850,13 +832,8 @@ def test_where(self, dtype):
850832
np.testing.assert_allclose(ret, reference)
851833

852834

853-
_TIME_UNITS = (
854-
"Y", "M", "W", "D", "h", "m", "s", "ms", "us", "ns", "ps", "fs", "as"
855-
)
856-
857-
# All `inexact` + `timdelta64` type codes
835+
# All `inexact` type codes
858836
_TYPE_CODES = list(np.typecodes["AllFloat"])
859-
_TYPE_CODES += [f"m8[{unit}]" for unit in _TIME_UNITS]
860837

861838

862839
@pytest.mark.xfail(reason='TODO: implement')

‎torch_np/tests/numpy_tests/lib/test_shape_base_.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -124,37 +124,6 @@ def test_3d(self):
124124
assert_array_equal(apply_along_axis(np.sum, 0, a),
125125
[[27, 30, 33], [36, 39, 42], [45, 48, 51]])
126126

127-
def test_preserve_subclass(self):
128-
def double(row):
129-
return row * 2
130-
131-
class MyNDArray(np.ndarray):
132-
pass
133-
134-
m = np.array([[0, 1], [2, 3]]).view(MyNDArray)
135-
expected = np.array([[0, 2], [4, 6]]).view(MyNDArray)
136-
137-
result = apply_along_axis(double, 0, m)
138-
assert_(isinstance(result, MyNDArray))
139-
assert_array_equal(result, expected)
140-
141-
result = apply_along_axis(double, 1, m)
142-
assert_(isinstance(result, MyNDArray))
143-
assert_array_equal(result, expected)
144-
145-
def test_subclass(self):
146-
class MinimalSubclass(np.ndarray):
147-
data = 1
148-
149-
def minimal_function(array):
150-
return array.data
151-
152-
a = np.zeros((6, 3)).view(MinimalSubclass)
153-
154-
assert_array_equal(
155-
apply_along_axis(minimal_function, 0, a), np.array([1, 1, 1])
156-
)
157-
158127
def test_scalar_array(self, cls=np.ndarray):
159128
a = np.ones((6, 3)).view(cls)
160129
res = apply_along_axis(np.sum, 0, a)
@@ -212,13 +181,6 @@ def f1to2(x):
212181
assert_equal(type(actual), type(expected))
213182
assert_equal(actual, expected)
214183

215-
def test_subclass_preservation(self):
216-
class MinimalSubclass(np.ndarray):
217-
pass
218-
self.test_scalar_array(MinimalSubclass)
219-
self.test_0d_array(MinimalSubclass)
220-
self.test_axis_insertion(MinimalSubclass)
221-
222184
def test_axis_insertion_ma(self):
223185
def f1to2(x):
224186
"""produces an asymmetric non-square matrix from x"""

0 commit comments

Comments
 (0)
Please sign in to comment.