summaryrefslogtreecommitdiffstats
path: root/tests/test_build/test_flatten.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_build/test_flatten.py')
-rw-r--r--tests/test_build/test_flatten.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/test_build/test_flatten.py b/tests/test_build/test_flatten.py
new file mode 100644
index 0000000..aacfdbd
--- /dev/null
+++ b/tests/test_build/test_flatten.py
@@ -0,0 +1,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