diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-09-16 09:09:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-09-16 09:09:35 +0000 |
commit | 0dfe1c9e2780469e3a4696e8fb3e6f717a7ebeb7 (patch) | |
tree | a0b651b55ea02e3b00bbc5eedba566fdd6bd7c08 /tests/test_build/test_combine.py | |
parent | Initial commit. (diff) | |
download | terminaltables-0dfe1c9e2780469e3a4696e8fb3e6f717a7ebeb7.tar.xz terminaltables-0dfe1c9e2780469e3a4696e8fb3e6f717a7ebeb7.zip |
Adding upstream version 3.1.0.upstream/3.1.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_build/test_combine.py')
-rw-r--r-- | tests/test_build/test_combine.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/test_build/test_combine.py b/tests/test_build/test_combine.py new file mode 100644 index 0000000..b296ffd --- /dev/null +++ b/tests/test_build/test_combine.py @@ -0,0 +1,37 @@ +"""Test function in module.""" + +import pytest + +from terminaltables.build import combine + + +@pytest.mark.parametrize('generator', [False, True]) +def test_borders(generator): + """Test with borders. + + :param bool generator: Test with generator instead of list. + """ + line = ['One', 'Two', 'Three'] + actual = list(combine(iter(line) if generator else line, '>', '|', '<')) + assert actual == ['>', 'One', '|', 'Two', '|', 'Three', '<'] + + +@pytest.mark.parametrize('generator', [False, True]) +def test_no_border(generator): + """Test without borders. + + :param bool generator: Test with generator instead of list. + """ + line = ['One', 'Two', 'Three'] + actual = list(combine(iter(line) if generator else line, '', '', '')) + assert actual == ['One', 'Two', 'Three'] + + +@pytest.mark.parametrize('generator', [False, True]) +def test_no_items(generator): + """Test with empty list. + + :param bool generator: Test with generator instead of list. + """ + actual = list(combine(iter([]) if generator else [], '>', '|', '<')) + assert actual == ['>', '<'] |