@@ -295,7 +295,7 @@ def _check(op):
295
295
index_result = op (index , element )
296
296
297
297
tm .assert_isinstance (index_result , np .ndarray )
298
- self .assert_ ( not isinstance ( index_result , Index ) )
298
+ self .assertNotIsInstance ( index_result , Index )
299
299
self .assert_numpy_array_equal (arr_result , index_result )
300
300
301
301
_check (operator .eq )
@@ -762,7 +762,7 @@ def test_boolean_cmp(self):
762
762
763
763
self .assert_ (res .all ())
764
764
self .assertEqual (res .dtype , 'bool' )
765
- self .assert_ ( not isinstance ( res , Index ) )
765
+ self .assertNotIsInstance ( res , Index )
766
766
767
767
def test_get_level_values (self ):
768
768
result = self .strIndex .get_level_values (0 )
@@ -808,35 +808,36 @@ def test_repr_roundtrip(self):
808
808
tm .assert_index_equal (eval (repr (ind )), ind )
809
809
810
810
def check_is_index (self , i ):
811
- self .assert_ (isinstance (i , Index ) and not isinstance (i , Float64Index ))
811
+ self .assertIsInstance (i , Index )
812
+ self .assertNotIsInstance (i , Float64Index )
812
813
813
814
def check_coerce (self , a , b , is_float_index = True ):
814
815
self .assert_ (a .equals (b ))
815
816
if is_float_index :
816
- self .assert_ ( isinstance ( b , Float64Index ) )
817
+ self .assertIsInstance ( b , Float64Index )
817
818
else :
818
819
self .check_is_index (b )
819
820
820
821
def test_constructor (self ):
821
822
822
823
# explicit construction
823
824
index = Float64Index ([1 ,2 ,3 ,4 ,5 ])
824
- self .assert_ ( isinstance ( index , Float64Index ) )
825
+ self .assertIsInstance ( index , Float64Index )
825
826
self .assert_ ((index .values == np .array ([1 ,2 ,3 ,4 ,5 ],dtype = 'float64' )).all ())
826
827
index = Float64Index (np .array ([1 ,2 ,3 ,4 ,5 ]))
827
- self .assert_ ( isinstance ( index , Float64Index ) )
828
+ self .assertIsInstance ( index , Float64Index )
828
829
index = Float64Index ([1. ,2 ,3 ,4 ,5 ])
829
- self .assert_ ( isinstance ( index , Float64Index ) )
830
+ self .assertIsInstance ( index , Float64Index )
830
831
index = Float64Index (np .array ([1. ,2 ,3 ,4 ,5 ]))
831
- self .assert_ ( isinstance ( index , Float64Index ) )
832
+ self .assertIsInstance ( index , Float64Index )
832
833
self .assertEqual (index .dtype , object )
833
834
834
835
index = Float64Index (np .array ([1. ,2 ,3 ,4 ,5 ]),dtype = np .float32 )
835
- self .assert_ ( isinstance ( index , Float64Index ) )
836
+ self .assertIsInstance ( index , Float64Index )
836
837
self .assertEqual (index .dtype , object )
837
838
838
839
index = Float64Index (np .array ([1 ,2 ,3 ,4 ,5 ]),dtype = np .float32 )
839
- self .assert_ ( isinstance ( index , Float64Index ) )
840
+ self .assertIsInstance ( index , Float64Index )
840
841
self .assertEqual (index .dtype , object )
841
842
842
843
# nan handling
@@ -1548,7 +1549,7 @@ def test_constructor_single_level(self):
1548
1549
labels = [[0 , 1 , 2 , 3 ]],
1549
1550
names = ['first' ])
1550
1551
tm .assert_isinstance (single_level , Index )
1551
- self .assert_ ( not isinstance ( single_level , MultiIndex ) )
1552
+ self .assertNotIsInstance ( single_level , MultiIndex )
1552
1553
self .assertEqual (single_level .name , 'first' )
1553
1554
1554
1555
single_level = MultiIndex (levels = [['foo' , 'bar' , 'baz' , 'qux' ]],
0 commit comments