Skip to content

Commit 6c4efc3

Browse files
SaturnFromTitanjreback
authored andcommitted
CLN: Consistent pandas.util.testing imports in remaining test suite (#29307)
1 parent 69f27a4 commit 6c4efc3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+276
-291
lines changed

pandas/tests/api/test_api.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import pandas as pd
44
from pandas import api, compat
5-
from pandas.util import testing as tm
5+
import pandas.util.testing as tm
66

77

88
class Base:

pandas/tests/api/test_types.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from pandas.api import types
2-
from pandas.util import testing as tm
2+
import pandas.util.testing as tm
33

44
from .test_api import Base
55

pandas/tests/arrays/sparse/test_array.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from pandas import isna
1313
from pandas.core.arrays.sparse import SparseArray, SparseDtype
1414
import pandas.util.testing as tm
15-
from pandas.util.testing import assert_almost_equal
1615

1716

1817
@pytest.fixture(params=["integer", "block"])
@@ -386,7 +385,7 @@ def test_constructor_from_too_large_array(self):
386385
def test_constructor_from_sparse(self):
387386
res = SparseArray(self.zarr)
388387
assert res.fill_value == 0
389-
assert_almost_equal(res.sp_values, self.zarr.sp_values)
388+
tm.assert_almost_equal(res.sp_values, self.zarr.sp_values)
390389

391390
def test_constructor_copy(self):
392391
cp = SparseArray(self.arr, copy=True)
@@ -586,7 +585,7 @@ def test_copy(self):
586585
assert arr2.sp_index is self.arr.sp_index
587586

588587
def test_values_asarray(self):
589-
assert_almost_equal(self.arr.to_dense(), self.arr_data)
588+
tm.assert_almost_equal(self.arr.to_dense(), self.arr_data)
590589

591590
@pytest.mark.parametrize(
592591
"data,shape,dtype",
@@ -625,7 +624,7 @@ def test_dense_repr(self, vals, fill_value):
625624

626625
def test_getitem(self):
627626
def _checkit(i):
628-
assert_almost_equal(self.arr[i], self.arr.to_dense()[i])
627+
tm.assert_almost_equal(self.arr[i], self.arr.to_dense()[i])
629628

630629
for i in range(len(self.arr)):
631630
_checkit(i)
@@ -703,7 +702,7 @@ def _check_op(op, first, second):
703702
op(first.to_dense(), second.to_dense()), fill_value=first.fill_value
704703
)
705704
assert isinstance(res, SparseArray)
706-
assert_almost_equal(res.to_dense(), exp.to_dense())
705+
tm.assert_almost_equal(res.to_dense(), exp.to_dense())
707706

708707
res2 = op(first, second.to_dense())
709708
assert isinstance(res2, SparseArray)
@@ -723,8 +722,8 @@ def _check_op(op, first, second):
723722
except ValueError:
724723
pass
725724
else:
726-
assert_almost_equal(res4.fill_value, exp_fv)
727-
assert_almost_equal(res4.to_dense(), exp)
725+
tm.assert_almost_equal(res4.fill_value, exp_fv)
726+
tm.assert_almost_equal(res4.to_dense(), exp)
728727

729728
with np.errstate(all="ignore"):
730729
for first_arr, second_arr in [(arr1, arr2), (farr1, farr2)]:

0 commit comments

Comments
 (0)