Basic columnize tests.
()
| 27 | #----------------------------------------------------------------------------- |
| 28 | |
| 29 | def test_columnize(): |
| 30 | """Basic columnize tests.""" |
| 31 | size = 5 |
| 32 | items = [l*size for l in 'abcd'] |
| 33 | |
| 34 | out = text.columnize(items, displaywidth=80) |
| 35 | nt.assert_equal(out, 'aaaaa bbbbb ccccc ddddd\n') |
| 36 | out = text.columnize(items, displaywidth=25) |
| 37 | nt.assert_equal(out, 'aaaaa ccccc\nbbbbb ddddd\n') |
| 38 | out = text.columnize(items, displaywidth=12) |
| 39 | nt.assert_equal(out, 'aaaaa ccccc\nbbbbb ddddd\n') |
| 40 | out = text.columnize(items, displaywidth=10) |
| 41 | nt.assert_equal(out, 'aaaaa\nbbbbb\nccccc\nddddd\n') |
| 42 | |
| 43 | out = text.columnize(items, row_first=True, displaywidth=80) |
| 44 | nt.assert_equal(out, 'aaaaa bbbbb ccccc ddddd\n') |
| 45 | out = text.columnize(items, row_first=True, displaywidth=25) |
| 46 | nt.assert_equal(out, 'aaaaa bbbbb\nccccc ddddd\n') |
| 47 | out = text.columnize(items, row_first=True, displaywidth=12) |
| 48 | nt.assert_equal(out, 'aaaaa bbbbb\nccccc ddddd\n') |
| 49 | out = text.columnize(items, row_first=True, displaywidth=10) |
| 50 | nt.assert_equal(out, 'aaaaa\nbbbbb\nccccc\nddddd\n') |
| 51 | |
| 52 | out = text.columnize(items, displaywidth=40, spread=True) |
| 53 | nt.assert_equal(out, 'aaaaa bbbbb ccccc ddddd\n') |
| 54 | out = text.columnize(items, displaywidth=20, spread=True) |
| 55 | nt.assert_equal(out, 'aaaaa ccccc\nbbbbb ddddd\n') |
| 56 | out = text.columnize(items, displaywidth=12, spread=True) |
| 57 | nt.assert_equal(out, 'aaaaa ccccc\nbbbbb ddddd\n') |
| 58 | out = text.columnize(items, displaywidth=10, spread=True) |
| 59 | nt.assert_equal(out, 'aaaaa\nbbbbb\nccccc\nddddd\n') |
| 60 | |
| 61 | |
| 62 | def test_columnize_random(): |
nothing calls this directly
no outgoing calls
no test coverage detected