@@ -705,17 +705,17 @@ def test_mi_sparse_column_names(self):
705
705
def test_hide_single_index (self ):
706
706
# single unnamed index
707
707
ctx = self .df .style ._translate ()
708
- self . assertTrue (ctx ['body' ][0 ][0 ]['is_visible' ])
709
- self . assertTrue (ctx ['head' ][0 ][0 ]['is_visible' ])
708
+ assert (ctx ['body' ][0 ][0 ]['is_visible' ])
709
+ assert (ctx ['head' ][0 ][0 ]['is_visible' ])
710
710
ctx2 = self .df .style .hide_index ()._translate ()
711
711
self .assertFalse (ctx2 ['body' ][0 ][0 ]['is_visible' ])
712
712
self .assertFalse (ctx2 ['head' ][0 ][0 ]['is_visible' ])
713
713
714
714
# single named index
715
715
ctx3 = self .df .set_index ('A' ).style ._translate ()
716
- self . assertTrue (ctx3 ['body' ][0 ][0 ]['is_visible' ])
716
+ assert (ctx3 ['body' ][0 ][0 ]['is_visible' ])
717
717
self .assertEqual (len (ctx3 ['head' ]), 2 ) # 2 header levels
718
- self . assertTrue (ctx3 ['head' ][0 ][0 ]['is_visible' ])
718
+ assert (ctx3 ['head' ][0 ][0 ]['is_visible' ])
719
719
720
720
ctx4 = self .df .set_index ('A' ).style .hide_index ()._translate ()
721
721
self .assertFalse (ctx4 ['body' ][0 ][0 ]['is_visible' ])
@@ -729,11 +729,11 @@ def test_hide_multiindex(self):
729
729
)
730
730
ctx1 = df .style ._translate ()
731
731
# tests for 'a' and '0'
732
- self . assertTrue (ctx1 ['body' ][0 ][0 ]['is_visible' ])
733
- self . assertTrue (ctx1 ['body' ][0 ][1 ]['is_visible' ])
732
+ assert (ctx1 ['body' ][0 ][0 ]['is_visible' ])
733
+ assert (ctx1 ['body' ][0 ][1 ]['is_visible' ])
734
734
# check for blank header rows
735
- self . assertTrue (ctx1 ['head' ][0 ][0 ]['is_visible' ])
736
- self . assertTrue (ctx1 ['head' ][0 ][1 ]['is_visible' ])
735
+ assert (ctx1 ['head' ][0 ][0 ]['is_visible' ])
736
+ assert (ctx1 ['head' ][0 ][1 ]['is_visible' ])
737
737
738
738
ctx2 = df .style .hide_index ()._translate ()
739
739
# tests for 'a' and '0'
@@ -746,17 +746,17 @@ def test_hide_multiindex(self):
746
746
def test_hide_columns_single_level (self ):
747
747
# test hiding single column
748
748
ctx = self .df .style ._translate ()
749
- self . assertTrue (ctx ['head' ][0 ][1 ]['is_visible' ])
749
+ assert (ctx ['head' ][0 ][1 ]['is_visible' ])
750
750
self .assertEqual (ctx ['head' ][0 ][1 ]['display_value' ], 'A' )
751
- self . assertTrue (ctx ['head' ][0 ][2 ]['is_visible' ])
751
+ assert (ctx ['head' ][0 ][2 ]['is_visible' ])
752
752
self .assertEqual (ctx ['head' ][0 ][2 ]['display_value' ], 'B' )
753
- self . assertTrue (ctx ['body' ][0 ][1 ]['is_visible' ]) # col A, row 1
754
- self . assertTrue (ctx ['body' ][1 ][2 ]['is_visible' ]) # col B, row 1
753
+ assert (ctx ['body' ][0 ][1 ]['is_visible' ]) # col A, row 1
754
+ assert (ctx ['body' ][1 ][2 ]['is_visible' ]) # col B, row 1
755
755
756
756
ctx = self .df .style .hide_columns ('A' )._translate ()
757
757
self .assertFalse (ctx ['head' ][0 ][1 ]['is_visible' ])
758
758
self .assertFalse (ctx ['body' ][0 ][1 ]['is_visible' ]) # col A, row 1
759
- self . assertTrue (ctx ['body' ][1 ][2 ]['is_visible' ]) # col B, row 1
759
+ assert (ctx ['body' ][1 ][2 ]['is_visible' ]) # col B, row 1
760
760
761
761
# test hiding mulitiple columns
762
762
ctx = self .df .style .hide_columns (['A' , 'B' ])._translate ()
@@ -776,40 +776,40 @@ def test_hide_columns_mult_levels(self):
776
776
df = pd .DataFrame ([[1 , 2 ], [3 , 4 ]], index = i1 , columns = i2 )
777
777
ctx = df .style ._translate ()
778
778
# column headers
779
- self . assertTrue (ctx ['head' ][0 ][2 ]['is_visible' ])
780
- self . assertTrue (ctx ['head' ][1 ][2 ]['is_visible' ])
779
+ assert (ctx ['head' ][0 ][2 ]['is_visible' ])
780
+ assert (ctx ['head' ][1 ][2 ]['is_visible' ])
781
781
self .assertEqual (ctx ['head' ][1 ][3 ]['display_value' ], 1 )
782
782
# indices
783
- self . assertTrue (ctx ['body' ][0 ][0 ]['is_visible' ])
783
+ assert (ctx ['body' ][0 ][0 ]['is_visible' ])
784
784
# data
785
- self . assertTrue (ctx ['body' ][1 ][2 ]['is_visible' ])
785
+ assert (ctx ['body' ][1 ][2 ]['is_visible' ])
786
786
self .assertEqual (ctx ['body' ][1 ][2 ]['display_value' ], 3 )
787
- self . assertTrue (ctx ['body' ][1 ][3 ]['is_visible' ])
787
+ assert (ctx ['body' ][1 ][3 ]['is_visible' ])
788
788
self .assertEqual (ctx ['body' ][1 ][3 ]['display_value' ], 4 )
789
789
790
790
# hide top column level, which hides both columns
791
791
ctx = df .style .hide_columns ('b' )._translate ()
792
792
self .assertFalse (ctx ['head' ][0 ][2 ]['is_visible' ]) # b
793
793
self .assertFalse (ctx ['head' ][1 ][2 ]['is_visible' ]) # 0
794
794
self .assertFalse (ctx ['body' ][1 ][2 ]['is_visible' ]) # 3
795
- self . assertTrue (ctx ['body' ][0 ][0 ]['is_visible' ]) # index
795
+ assert (ctx ['body' ][0 ][0 ]['is_visible' ]) # index
796
796
797
797
# hide first column only
798
798
ctx = df .style .hide_columns ([('b' , 0 )])._translate ()
799
- self . assertTrue (ctx ['head' ][0 ][2 ]['is_visible' ]) # b
799
+ assert (ctx ['head' ][0 ][2 ]['is_visible' ]) # b
800
800
self .assertFalse (ctx ['head' ][1 ][2 ]['is_visible' ]) # 0
801
801
self .assertFalse (ctx ['body' ][1 ][2 ]['is_visible' ]) # 3
802
- self . assertTrue (ctx ['body' ][1 ][3 ]['is_visible' ])
802
+ assert (ctx ['body' ][1 ][3 ]['is_visible' ])
803
803
self .assertEqual (ctx ['body' ][1 ][3 ]['display_value' ], 4 )
804
804
805
805
# hide second column and index
806
806
ctx = df .style .hide_columns ([('b' , 1 )]).hide_index ()._translate ()
807
807
self .assertFalse (ctx ['body' ][0 ][0 ]['is_visible' ]) # index
808
- self . assertTrue (ctx ['head' ][0 ][2 ]['is_visible' ]) # b
809
- self . assertTrue (ctx ['head' ][1 ][2 ]['is_visible' ]) # 0
808
+ assert (ctx ['head' ][0 ][2 ]['is_visible' ]) # b
809
+ assert (ctx ['head' ][1 ][2 ]['is_visible' ]) # 0
810
810
self .assertFalse (ctx ['head' ][1 ][3 ]['is_visible' ]) # 1
811
811
self .assertFalse (ctx ['body' ][1 ][3 ]['is_visible' ]) # 4
812
- self . assertTrue (ctx ['body' ][1 ][2 ]['is_visible' ])
812
+ assert (ctx ['body' ][1 ][2 ]['is_visible' ])
813
813
self .assertEqual (ctx ['body' ][1 ][2 ]['display_value' ], 3 )
814
814
815
815
0 commit comments