12
12
from pandas import isna
13
13
from pandas .core .arrays .sparse import SparseArray , SparseDtype
14
14
import pandas .util .testing as tm
15
- from pandas .util .testing import assert_almost_equal
16
15
17
16
18
17
@pytest .fixture (params = ["integer" , "block" ])
@@ -386,7 +385,7 @@ def test_constructor_from_too_large_array(self):
386
385
def test_constructor_from_sparse (self ):
387
386
res = SparseArray (self .zarr )
388
387
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 )
390
389
391
390
def test_constructor_copy (self ):
392
391
cp = SparseArray (self .arr , copy = True )
@@ -586,7 +585,7 @@ def test_copy(self):
586
585
assert arr2 .sp_index is self .arr .sp_index
587
586
588
587
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 )
590
589
591
590
@pytest .mark .parametrize (
592
591
"data,shape,dtype" ,
@@ -625,7 +624,7 @@ def test_dense_repr(self, vals, fill_value):
625
624
626
625
def test_getitem (self ):
627
626
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 ])
629
628
630
629
for i in range (len (self .arr )):
631
630
_checkit (i )
@@ -703,7 +702,7 @@ def _check_op(op, first, second):
703
702
op (first .to_dense (), second .to_dense ()), fill_value = first .fill_value
704
703
)
705
704
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 ())
707
706
708
707
res2 = op (first , second .to_dense ())
709
708
assert isinstance (res2 , SparseArray )
@@ -723,8 +722,8 @@ def _check_op(op, first, second):
723
722
except ValueError :
724
723
pass
725
724
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 )
728
727
729
728
with np .errstate (all = "ignore" ):
730
729
for first_arr , second_arr in [(arr1 , arr2 ), (farr1 , farr2 )]:
0 commit comments