Skip to content

Commit 8aebb11

Browse files
committed
TST: Verify columns entirely below chop_threshold still print (pandas-dev#6839)
1 parent b2b5dc3 commit 8aebb11

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

pandas/tests/io/formats/test_format.py

+27
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,33 @@ def test_repr_chop_threshold(self):
209209
with option_context("display.chop_threshold", None):
210210
assert repr(df) == ' 0 1\n0 0.1 0.5\n1 0.5 -0.1'
211211

212+
def test_repr_chop_threshold_column_below(self):
213+
# GH 6839: validation case
214+
215+
df = pd.DataFrame([[10, 20, 30, 40],
216+
[8e-10, -1e-11, 2e-9, -2e-11]]).T
217+
218+
with option_context("display.chop_threshold", 0):
219+
assert repr(df) == (' 0 1\n'
220+
'0 10.0 8.000000e-10\n'
221+
'1 20.0 -1.000000e-11\n'
222+
'2 30.0 2.000000e-09\n'
223+
'3 40.0 -2.000000e-11')
224+
225+
with option_context("display.chop_threshold", 1e-8):
226+
assert repr(df) == (' 0 1\n'
227+
'0 10.0 0.000000e+00\n'
228+
'1 20.0 0.000000e+00\n'
229+
'2 30.0 0.000000e+00\n'
230+
'3 40.0 0.000000e+00')
231+
232+
with option_context("display.chop_threshold", 5e-11):
233+
assert repr(df) == (' 0 1\n'
234+
'0 10.0 8.000000e-10\n'
235+
'1 20.0 0.000000e+00\n'
236+
'2 30.0 2.000000e-09\n'
237+
'3 40.0 0.000000e+00')
238+
212239
def test_repr_obeys_max_seq_limit(self):
213240
with option_context("display.max_seq_items", 2000):
214241
assert len(printing.pprint_thing(lrange(1000))) > 1000

0 commit comments

Comments
 (0)