@@ -817,19 +817,19 @@ def test_hide_single_index(self):
817
817
assert (ctx ['body' ][0 ][0 ]['is_visible' ])
818
818
assert (ctx ['head' ][0 ][0 ]['is_visible' ])
819
819
ctx2 = self .df .style .hide_index ()._translate ()
820
- self . assertFalse ( ctx2 ['body' ][0 ][0 ]['is_visible' ])
821
- self . assertFalse ( ctx2 ['head' ][0 ][0 ]['is_visible' ])
820
+ assert ( not ctx2 ['body' ][0 ][0 ]['is_visible' ])
821
+ assert ( not ctx2 ['head' ][0 ][0 ]['is_visible' ])
822
822
823
823
# single named index
824
824
ctx3 = self .df .set_index ('A' ).style ._translate ()
825
825
assert (ctx3 ['body' ][0 ][0 ]['is_visible' ])
826
- self . assertEqual (len (ctx3 ['head' ]), 2 ) # 2 header levels
826
+ assert (len (ctx3 ['head' ]) == 2 ) # 2 header levels
827
827
assert (ctx3 ['head' ][0 ][0 ]['is_visible' ])
828
828
829
829
ctx4 = self .df .set_index ('A' ).style .hide_index ()._translate ()
830
- self . assertFalse ( ctx4 ['body' ][0 ][0 ]['is_visible' ])
831
- self . assertEqual (len (ctx4 ['head' ]), 1 ) # only 1 header levels
832
- self . assertFalse ( ctx4 ['head' ][0 ][0 ]['is_visible' ])
830
+ assert ( not ctx4 ['body' ][0 ][0 ]['is_visible' ])
831
+ assert (len (ctx4 ['head' ]) == 1 ) # only 1 header levels
832
+ assert ( not ctx4 ['head' ][0 ][0 ]['is_visible' ])
833
833
834
834
def test_hide_multiindex (self ):
835
835
df = pd .DataFrame ({'A' : [1 , 2 ]}, index = pd .MultiIndex .from_arrays (
@@ -846,33 +846,33 @@ def test_hide_multiindex(self):
846
846
847
847
ctx2 = df .style .hide_index ()._translate ()
848
848
# tests for 'a' and '0'
849
- self . assertFalse ( ctx2 ['body' ][0 ][0 ]['is_visible' ])
850
- self . assertFalse ( ctx2 ['body' ][0 ][1 ]['is_visible' ])
849
+ assert ( not ctx2 ['body' ][0 ][0 ]['is_visible' ])
850
+ assert ( not ctx2 ['body' ][0 ][1 ]['is_visible' ])
851
851
# check for blank header rows
852
- self . assertFalse ( ctx2 ['head' ][0 ][0 ]['is_visible' ])
853
- self . assertFalse ( ctx2 ['head' ][0 ][1 ]['is_visible' ])
852
+ assert ( not ctx2 ['head' ][0 ][0 ]['is_visible' ])
853
+ assert ( not ctx2 ['head' ][0 ][1 ]['is_visible' ])
854
854
855
855
def test_hide_columns_single_level (self ):
856
856
# test hiding single column
857
857
ctx = self .df .style ._translate ()
858
858
assert (ctx ['head' ][0 ][1 ]['is_visible' ])
859
- self . assertEqual (ctx ['head' ][0 ][1 ]['display_value' ], 'A' )
859
+ assert (ctx ['head' ][0 ][1 ]['display_value' ] == 'A' )
860
860
assert (ctx ['head' ][0 ][2 ]['is_visible' ])
861
- self . assertEqual (ctx ['head' ][0 ][2 ]['display_value' ], 'B' )
861
+ assert (ctx ['head' ][0 ][2 ]['display_value' ] == 'B' )
862
862
assert (ctx ['body' ][0 ][1 ]['is_visible' ]) # col A, row 1
863
863
assert (ctx ['body' ][1 ][2 ]['is_visible' ]) # col B, row 1
864
864
865
865
ctx = self .df .style .hide_columns ('A' )._translate ()
866
- self . assertFalse ( ctx ['head' ][0 ][1 ]['is_visible' ])
867
- self . assertFalse ( ctx ['body' ][0 ][1 ]['is_visible' ]) # col A, row 1
866
+ assert ( not ctx ['head' ][0 ][1 ]['is_visible' ])
867
+ assert ( not ctx ['body' ][0 ][1 ]['is_visible' ]) # col A, row 1
868
868
assert (ctx ['body' ][1 ][2 ]['is_visible' ]) # col B, row 1
869
869
870
870
# test hiding mulitiple columns
871
871
ctx = self .df .style .hide_columns (['A' , 'B' ])._translate ()
872
- self . assertFalse ( ctx ['head' ][0 ][1 ]['is_visible' ])
873
- self . assertFalse ( ctx ['head' ][0 ][2 ]['is_visible' ])
874
- self . assertFalse ( ctx ['body' ][0 ][1 ]['is_visible' ]) # col A, row 1
875
- self . assertFalse ( ctx ['body' ][1 ][2 ]['is_visible' ]) # col B, row 1
872
+ assert ( not ctx ['head' ][0 ][1 ]['is_visible' ])
873
+ assert ( not ctx ['head' ][0 ][2 ]['is_visible' ])
874
+ assert ( not ctx ['body' ][0 ][1 ]['is_visible' ]) # col A, row 1
875
+ assert ( not ctx ['body' ][1 ][2 ]['is_visible' ]) # col B, row 1
876
876
877
877
def test_hide_columns_mult_levels (self ):
878
878
# setup dataframe with multiple column levels and indices
@@ -887,39 +887,39 @@ def test_hide_columns_mult_levels(self):
887
887
# column headers
888
888
assert (ctx ['head' ][0 ][2 ]['is_visible' ])
889
889
assert (ctx ['head' ][1 ][2 ]['is_visible' ])
890
- self . assertEqual (ctx ['head' ][1 ][3 ]['display_value' ], 1 )
890
+ assert (ctx ['head' ][1 ][3 ]['display_value' ] == 1 )
891
891
# indices
892
892
assert (ctx ['body' ][0 ][0 ]['is_visible' ])
893
893
# data
894
894
assert (ctx ['body' ][1 ][2 ]['is_visible' ])
895
- self . assertEqual (ctx ['body' ][1 ][2 ]['display_value' ], 3 )
895
+ assert (ctx ['body' ][1 ][2 ]['display_value' ] == 3 )
896
896
assert (ctx ['body' ][1 ][3 ]['is_visible' ])
897
- self . assertEqual (ctx ['body' ][1 ][3 ]['display_value' ], 4 )
897
+ assert (ctx ['body' ][1 ][3 ]['display_value' ] == 4 )
898
898
899
899
# hide top column level, which hides both columns
900
900
ctx = df .style .hide_columns ('b' )._translate ()
901
- self . assertFalse ( ctx ['head' ][0 ][2 ]['is_visible' ]) # b
902
- self . assertFalse ( ctx ['head' ][1 ][2 ]['is_visible' ]) # 0
903
- self . assertFalse ( ctx ['body' ][1 ][2 ]['is_visible' ]) # 3
901
+ assert ( not ctx ['head' ][0 ][2 ]['is_visible' ]) # b
902
+ assert ( not ctx ['head' ][1 ][2 ]['is_visible' ]) # 0
903
+ assert ( not ctx ['body' ][1 ][2 ]['is_visible' ]) # 3
904
904
assert (ctx ['body' ][0 ][0 ]['is_visible' ]) # index
905
905
906
906
# hide first column only
907
907
ctx = df .style .hide_columns ([('b' , 0 )])._translate ()
908
908
assert (ctx ['head' ][0 ][2 ]['is_visible' ]) # b
909
- self . assertFalse ( ctx ['head' ][1 ][2 ]['is_visible' ]) # 0
910
- self . assertFalse ( ctx ['body' ][1 ][2 ]['is_visible' ]) # 3
909
+ assert ( not ctx ['head' ][1 ][2 ]['is_visible' ]) # 0
910
+ assert ( not ctx ['body' ][1 ][2 ]['is_visible' ]) # 3
911
911
assert (ctx ['body' ][1 ][3 ]['is_visible' ])
912
- self . assertEqual (ctx ['body' ][1 ][3 ]['display_value' ], 4 )
912
+ assert (ctx ['body' ][1 ][3 ]['display_value' ] == 4 )
913
913
914
914
# hide second column and index
915
915
ctx = df .style .hide_columns ([('b' , 1 )]).hide_index ()._translate ()
916
- self . assertFalse ( ctx ['body' ][0 ][0 ]['is_visible' ]) # index
916
+ assert ( not ctx ['body' ][0 ][0 ]['is_visible' ]) # index
917
917
assert (ctx ['head' ][0 ][2 ]['is_visible' ]) # b
918
918
assert (ctx ['head' ][1 ][2 ]['is_visible' ]) # 0
919
- self . assertFalse ( ctx ['head' ][1 ][3 ]['is_visible' ]) # 1
920
- self . assertFalse ( ctx ['body' ][1 ][3 ]['is_visible' ]) # 4
919
+ assert ( not ctx ['head' ][1 ][3 ]['is_visible' ]) # 1
920
+ assert ( not ctx ['body' ][1 ][3 ]['is_visible' ]) # 4
921
921
assert (ctx ['body' ][1 ][2 ]['is_visible' ])
922
- self . assertEqual (ctx ['body' ][1 ][2 ]['display_value' ], 3 )
922
+ assert (ctx ['body' ][1 ][2 ]['display_value' ] == 3 )
923
923
924
924
925
925
class TestStylerMatplotlibDep (object ):
0 commit comments