Skip to content

Commit 09e47bc

Browse files
author
y-p
committed
BUG/TST: fix tests for expand_repr behaviour
1 parent 0a4411b commit 09e47bc

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

pandas/tests/test_format.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def test_expand_frame_repr(self):
170170
df_tall = DataFrame('hello', range(30), range(5))
171171

172172
with option_context('mode.sim_interactive', True):
173-
with option_context('display.max_columns', 5,
173+
with option_context('display.max_columns', 10,
174174
'display.width',20,
175175
'display.max_rows', 20):
176176
with option_context('display.expand_frame_repr', True):
@@ -222,7 +222,7 @@ def mkframe(n):
222222
self.assertTrue(has_info_repr(df6))
223223

224224
with option_context('display.max_rows', 20,
225-
'display.max_columns', 5):
225+
'display.max_columns', 10):
226226
# Out off max_columns boundary, but no extending
227227
# since not exceeding width
228228
self.assertFalse(has_expanded_repr(df6))
@@ -791,7 +791,7 @@ def test_wide_repr(self):
791791
with option_context('mode.sim_interactive', True):
792792
col = lambda l, k: [tm.rands(k) for _ in xrange(l)]
793793
max_cols = get_option('display.max_columns')
794-
df = DataFrame([col(max_cols+1, 25) for _ in range(10)])
794+
df = DataFrame([col(max_cols-1, 25) for _ in range(10)])
795795
set_option('display.expand_frame_repr', False)
796796
rep_str = repr(df)
797797
set_option('display.expand_frame_repr', True)
@@ -815,7 +815,7 @@ def test_wide_repr_named(self):
815815
with option_context('mode.sim_interactive', True):
816816
col = lambda l, k: [tm.rands(k) for _ in xrange(l)]
817817
max_cols = get_option('display.max_columns')
818-
df = DataFrame([col(max_cols+1, 25) for _ in range(10)])
818+
df = DataFrame([col(max_cols-1, 25) for _ in range(10)])
819819
df.index.name = 'DataFrame Index'
820820
set_option('display.expand_frame_repr', False)
821821

@@ -839,7 +839,7 @@ def test_wide_repr_multiindex(self):
839839
midx = pandas.MultiIndex.from_arrays([np.array(col(10, 5)),
840840
np.array(col(10, 5))])
841841
max_cols = get_option('display.max_columns')
842-
df = DataFrame([col(max_cols+1, 25) for _ in range(10)],
842+
df = DataFrame([col(max_cols-1, 25) for _ in range(10)],
843843
index=midx)
844844
df.index.names = ['Level 0', 'Level 1']
845845
set_option('display.expand_frame_repr', False)
@@ -863,9 +863,9 @@ def test_wide_repr_multiindex_cols(self):
863863
col = lambda l, k: [tm.rands(k) for _ in xrange(l)]
864864
midx = pandas.MultiIndex.from_arrays([np.array(col(10, 5)),
865865
np.array(col(10, 5))])
866-
mcols = pandas.MultiIndex.from_arrays([np.array(col(max_cols+1, 3)),
867-
np.array(col(max_cols+1, 3))])
868-
df = DataFrame([col(max_cols+1, 25) for _ in range(10)],
866+
mcols = pandas.MultiIndex.from_arrays([np.array(col(max_cols-1, 3)),
867+
np.array(col(max_cols-1, 3))])
868+
df = DataFrame([col(max_cols-1, 25) for _ in range(10)],
869869
index=midx, columns=mcols)
870870
df.index.names = ['Level 0', 'Level 1']
871871
set_option('display.expand_frame_repr', False)
@@ -884,7 +884,7 @@ def test_wide_repr_unicode(self):
884884
with option_context('mode.sim_interactive', True):
885885
col = lambda l, k: [tm.randu(k) for _ in xrange(l)]
886886
max_cols = get_option('display.max_columns')
887-
df = DataFrame([col(max_cols+1, 25) for _ in range(10)])
887+
df = DataFrame([col(max_cols-1, 25) for _ in range(10)])
888888
set_option('display.expand_frame_repr', False)
889889
rep_str = repr(df)
890890
set_option('display.expand_frame_repr', True)

0 commit comments

Comments
 (0)