summaryrefslogtreecommitdiffstats
path: root/tests/test_build/test_combine.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_build/test_combine.py')
-rw-r--r--tests/test_build/test_combine.py37
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 == ['>', '<']