def test_table_empty(): rows = [] table = ResponsiveTable(MockUI(), SimpleListWalker(rows)) canvas = table.render((80, 20), focus=False) text = [bytes().join([t for at, cs, t in ln]) for ln in canvas.content()] assert len(text) == 20 assert text[0] == b" " * 80
def test_table_random_data(): rows = [ResponsiveRowWidget([get_random_text_widget(random.randint(2, 9)) for _ in range(5)]) for _ in range(5)] table = ResponsiveTable(MockUI(), SimpleListWalker(rows)) canvas = table.render((80, 20), focus=False) text = [bytes().join([t for at, cs, t in ln]) for ln in canvas.content()] logging.info("%r", text) assert len(text) == 20 assert text[0].startswith(rows[0].original_widget.widget_list[0].text.encode("utf-8"))
def test_table_random_data(): rows = [ ResponsiveRowWidget( [get_random_text_widget(random.randint(2, 9)) for _ in range(5)]) for _ in range(5) ] table = ResponsiveTable(MockUI(), SimpleListWalker(rows)) canvas = table.render((80, 20), focus=False) text = [bytes().join([t for at, cs, t in ln]) for ln in canvas.content()] logging.info("%r", text) assert len(text) == 20 assert text[0].startswith( rows[0].original_widget.widget_list[0].text.encode("utf-8"))