def test_auto_detect(self):
term_width, term_height = get_terminal_size()
fac = 1.05 # Arbitrary large factor to exceed term widht
cols = range(int(term_width * fac))
index = range(10)
df = DataFrame(index=index, columns=cols)
with option_context('mode.sim_interactive', True):
with option_context('max_rows', None):
with option_context('max_columns', None):
# Wrap around with None
self.assertTrue(has_expanded_repr(df))
with option_context('max_rows', 0):
with option_context('max_columns', 0):
# Truncate with auto detection.
self.assertTrue(has_horizontally_truncated_repr(df))
index = range(int(term_height * fac))
df = DataFrame(index=index, columns=cols)
with option_context('max_rows', 0):
with option_context('max_columns', None):
# Wrap around with None
self.assertTrue(has_expanded_repr(df))
# Truncate vertically
self.assertTrue(has_vertically_truncated_repr(df))
with option_context('max_rows', None):
with option_context('max_columns', 0):
self.assertTrue(has_horizontally_truncated_repr(df))
test_format.py 文件源码
python
阅读 29
收藏 0
点赞 0
评论 0
评论列表
文章目录