Skip to content

Commit

Permalink
CLN: Consistent pandas.util.testing imports in remaining test suite (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
SaturnFromTitan authored and jreback committed Oct 31, 2019
1 parent 69f27a4 commit 6c4efc3
Show file tree
Hide file tree
Showing 70 changed files with 276 additions and 291 deletions.
2 changes: 1 addition & 1 deletion pandas/tests/api/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pandas as pd
from pandas import api, compat
from pandas.util import testing as tm
import pandas.util.testing as tm


class Base:
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/api/test_types.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from pandas.api import types
from pandas.util import testing as tm
import pandas.util.testing as tm

from .test_api import Base

Expand Down
13 changes: 6 additions & 7 deletions pandas/tests/arrays/sparse/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from pandas import isna
from pandas.core.arrays.sparse import SparseArray, SparseDtype
import pandas.util.testing as tm
from pandas.util.testing import assert_almost_equal


@pytest.fixture(params=["integer", "block"])
Expand Down Expand Up @@ -386,7 +385,7 @@ def test_constructor_from_too_large_array(self):
def test_constructor_from_sparse(self):
res = SparseArray(self.zarr)
assert res.fill_value == 0
assert_almost_equal(res.sp_values, self.zarr.sp_values)
tm.assert_almost_equal(res.sp_values, self.zarr.sp_values)

def test_constructor_copy(self):
cp = SparseArray(self.arr, copy=True)
Expand Down Expand Up @@ -586,7 +585,7 @@ def test_copy(self):
assert arr2.sp_index is self.arr.sp_index

def test_values_asarray(self):
assert_almost_equal(self.arr.to_dense(), self.arr_data)
tm.assert_almost_equal(self.arr.to_dense(), self.arr_data)

@pytest.mark.parametrize(
"data,shape,dtype",
Expand Down Expand Up @@ -625,7 +624,7 @@ def test_dense_repr(self, vals, fill_value):

def test_getitem(self):
def _checkit(i):
assert_almost_equal(self.arr[i], self.arr.to_dense()[i])
tm.assert_almost_equal(self.arr[i], self.arr.to_dense()[i])

for i in range(len(self.arr)):
_checkit(i)
Expand Down Expand Up @@ -703,7 +702,7 @@ def _check_op(op, first, second):
op(first.to_dense(), second.to_dense()), fill_value=first.fill_value
)
assert isinstance(res, SparseArray)
assert_almost_equal(res.to_dense(), exp.to_dense())
tm.assert_almost_equal(res.to_dense(), exp.to_dense())

res2 = op(first, second.to_dense())
assert isinstance(res2, SparseArray)
Expand All @@ -723,8 +722,8 @@ def _check_op(op, first, second):
except ValueError:
pass
else:
assert_almost_equal(res4.fill_value, exp_fv)
assert_almost_equal(res4.to_dense(), exp)
tm.assert_almost_equal(res4.fill_value, exp_fv)
tm.assert_almost_equal(res4.to_dense(), exp)

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

0 comments on commit 6c4efc3

Please sign in to comment.