MCPcopy Create free account
hub / github.com/aws/aws-cli / test_add_row_tracks_max_widths

Method test_add_row_tracks_max_widths

tests/unit/test_table.py:31–41  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

29 self.section = Section()
30
31 def test_add_row_tracks_max_widths(self):
32 self.section.add_row(['one', 'two', 'three'])
33 self.assertEqual(self.section.calculate_column_widths(), [3, 3, 5])
34 self.section.add_row(['1234567', '1234567', '1234567'])
35 self.assertEqual(self.section.calculate_column_widths(), [7, 7, 7])
36 self.section.add_row(['a', 'a', 'a'])
37 self.assertEqual(self.section.calculate_column_widths(), [7, 7, 7])
38 self.section.add_row(['123456789', '1', '1'])
39 self.assertEqual(self.section.calculate_column_widths(), [9, 7, 7])
40 self.assertEqual(self.section.calculate_column_widths(1), [10, 8, 8])
41 self.assertEqual(self.section.total_width(), 23)
42
43 def test_add_row_also_tracks_header(self):
44 self.section.add_header(['123456789', '12345', '1234567'])

Callers

nothing calls this directly

Calls 3

total_widthMethod · 0.80
add_rowMethod · 0.45

Tested by

no test coverage detected