summaryrefslogtreecommitdiffstats
path: root/tests/test_build/test_flatten.py
blob: aacfdbdc8a8555e52c9d7a63ac7f35daa783c4f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"""Test function in module."""

from terminaltables.build import flatten


def test_one_line():
    """Test with one line cells."""
    table = [
        ['>', 'Left Cell', '|', 'Center Cell', '|', 'Right Cell', '<'],
    ]
    actual = flatten(table)
    expected = '>Left Cell|Center Cell|Right Cell<'
    assert actual == expected


def test_two_line():
    """Test with two line cells."""
    table = [
        ['>', 'Left ', '|', 'Center', '|', 'Right', '<'],
        ['>', 'Cell1', '|', 'Cell2 ', '|', 'Cell3', '<'],
    ]
    actual = flatten(table)
    expected = ('>Left |Center|Right<\n'
                '>Cell1|Cell2 |Cell3<')
    assert actual == expected