@@ -48,3 +48,46 @@ def test_display_float_format():
4848 formatter = "{,.2f}" .format
4949 with pd .option_context ("display.float_format" , formatter ):
5050 assert pd .get_option ("display.float_format" ) == formatter
51+
52+
53+ def test_display_types_none_allowed ():
54+ # GH 1230
55+ properties_to_test = [
56+ "max_columns" ,
57+ "max_colwidth" ,
58+ "max_dir_items" ,
59+ "max_rows" ,
60+ "max_seq_items" ,
61+ "min_rows" ,
62+ ]
63+ for prop in properties_to_test :
64+ # Test with None
65+ setattr (pd .options .display , prop , None )
66+ check (assert_type (pd .get_option (f"display.{ prop } " ), Any ), type (None ))
67+
68+ # Test with integer values
69+ setattr (pd .options .display , prop , 100 )
70+ check (assert_type (pd .get_option (f"display.{ prop } " ), Any ), int )
71+
72+
73+ def test_display_types_literal_constraints ():
74+ # GH 1230
75+ # Various display options have specific allowed values, check assignment
76+ # Test colheader_justify with allowed values
77+ pd .options .display .colheader_justify = "left"
78+ pd .options .display .colheader_justify = "right"
79+
80+ # Test large_repr with allowed values
81+ pd .options .display .large_repr = "truncate"
82+ pd .options .display .large_repr = "info"
83+
84+ # Test memory_usage with allowed values
85+ pd .options .display .memory_usage = True
86+ pd .options .display .memory_usage = False
87+ pd .options .display .memory_usage = "deep"
88+ pd .options .display .memory_usage = None
89+
90+ # Test show_dimensions with allowed values
91+ pd .options .display .show_dimensions = True
92+ pd .options .display .show_dimensions = False
93+ pd .options .display .show_dimensions = "truncate"
0 commit comments