This repository has been archived by the owner on Dec 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finished cloning tests for all tables.
- Loading branch information
Showing
7 changed files
with
271 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
# coding=utf-8 | ||
"""AsciiTable end to end testing.""" | ||
|
||
from terminaltables import AsciiTable | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,188 @@ | ||
"""DoubleTable end to end testing.""" | ||
|
||
from terminaltables import DoubleTable | ||
|
||
|
||
def test_single_line(): | ||
"""Test single-lined cells.""" | ||
table_data = [ | ||
['Name', 'Color', 'Type'], | ||
['Avocado', 'green', 'nut'], | ||
['Tomato', 'red', 'fruit'], | ||
['Lettuce', 'green', 'vegetable'], | ||
['Watermelon', 'green'], | ||
[], | ||
] | ||
table = DoubleTable(table_data, 'Example') | ||
table.inner_footing_row_border = True | ||
table.justify_columns[0] = 'left' | ||
table.justify_columns[1] = 'center' | ||
table.justify_columns[2] = 'right' | ||
actual = table.table | ||
|
||
expected = ( | ||
u'\u2554Example\u2550\u2550\u2550\u2550\u2550\u2566\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2566\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557\n' | ||
|
||
u'\u2551 Name \u2551 Color \u2551 Type \u2551\n' | ||
|
||
u'\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256c\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u256c\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563\n' | ||
|
||
u'\u2551 Avocado \u2551 green \u2551 nut \u2551\n' | ||
|
||
u'\u2551 Tomato \u2551 red \u2551 fruit \u2551\n' | ||
|
||
u'\u2551 Lettuce \u2551 green \u2551 vegetable \u2551\n' | ||
|
||
u'\u2551 Watermelon \u2551 green \u2551 \u2551\n' | ||
|
||
u'\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256c\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u256c\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563\n' | ||
|
||
u'\u2551 \u2551 \u2551 \u2551\n' | ||
|
||
u'\u255a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2569\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2569\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255d' | ||
) | ||
assert actual == expected | ||
|
||
|
||
def test_multi_line(): | ||
"""Test multi-lined cells.""" | ||
table_data = [ | ||
['Show', 'Characters'], | ||
['Rugrats', 'Tommy Pickles, Chuckie Finster, Phillip DeVille, Lillian DeVille, Angelica Pickles,\nDil Pickles'], | ||
['South Park', 'Stan Marsh, Kyle Broflovski, Eric Cartman, Kenny McCormick'] | ||
] | ||
table = DoubleTable(table_data) | ||
|
||
# Test defaults. | ||
actual = table.table | ||
expected = ( | ||
u'\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2566\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557\n' | ||
|
||
u'\u2551 Show \u2551 Characters ' | ||
u'\u2551\n' | ||
|
||
u'\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256c\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563\n' | ||
|
||
u'\u2551 Rugrats \u2551 Tommy Pickles, Chuckie Finster, Phillip DeVille, Lillian DeVille, Angelica Pickles, ' | ||
u'\u2551\n' | ||
|
||
u'\u2551 \u2551 Dil Pickles ' | ||
u'\u2551\n' | ||
|
||
u'\u2551 South Park \u2551 Stan Marsh, Kyle Broflovski, Eric Cartman, Kenny McCormick ' | ||
u'\u2551\n' | ||
|
||
u'\u255a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2569\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255d' | ||
) | ||
assert actual == expected | ||
|
||
# Test inner row border. | ||
table.inner_row_border = True | ||
actual = table.table | ||
expected = ( | ||
u'\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2566\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557\n' | ||
|
||
u'\u2551 Show \u2551 Characters ' | ||
u'\u2551\n' | ||
|
||
u'\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256c\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563\n' | ||
|
||
u'\u2551 Rugrats \u2551 Tommy Pickles, Chuckie Finster, Phillip DeVille, Lillian DeVille, Angelica Pickles, ' | ||
u'\u2551\n' | ||
|
||
u'\u2551 \u2551 Dil Pickles ' | ||
u'\u2551\n' | ||
|
||
u'\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256c\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563\n' | ||
|
||
u'\u2551 South Park \u2551 Stan Marsh, Kyle Broflovski, Eric Cartman, Kenny McCormick ' | ||
u'\u2551\n' | ||
|
||
u'\u255a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2569\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255d' | ||
) | ||
assert actual == expected | ||
|
||
# Justify right. | ||
table.justify_columns = {1: 'right'} | ||
actual = table.table | ||
expected = ( | ||
u'\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2566\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557\n' | ||
|
||
u'\u2551 Show \u2551 Characters ' | ||
u'\u2551\n' | ||
|
||
u'\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256c\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563\n' | ||
|
||
u'\u2551 Rugrats \u2551 Tommy Pickles, Chuckie Finster, Phillip DeVille, Lillian DeVille, Angelica Pickles, ' | ||
u'\u2551\n' | ||
|
||
u'\u2551 \u2551 Dil Pickles ' | ||
u'\u2551\n' | ||
|
||
u'\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256c\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563\n' | ||
|
||
u'\u2551 South Park \u2551 Stan Marsh, Kyle Broflovski, Eric Cartman, Kenny McCormick ' | ||
u'\u2551\n' | ||
|
||
u'\u255a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2569\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550' | ||
u'\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255d' | ||
) | ||
assert actual == expected |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
"""GithubFlavoredMarkdownTable end to end testing.""" | ||
|
||
from terminaltables import GithubFlavoredMarkdownTable | ||
|
||
|
||
def test_single_line(): | ||
"""Test single-lined cells.""" | ||
table_data = [ | ||
['Name', 'Color', 'Type'], | ||
['Avocado', 'green', 'nut'], | ||
['Tomato', 'red', 'fruit'], | ||
['Lettuce', 'green', 'vegetable'], | ||
['Watermelon', 'green'], | ||
[], | ||
] | ||
table = GithubFlavoredMarkdownTable(table_data) | ||
table.inner_footing_row_border = True | ||
table.justify_columns[0] = 'left' | ||
table.justify_columns[1] = 'center' | ||
table.justify_columns[2] = 'right' | ||
actual = table.table | ||
|
||
expected = ( | ||
'| Name | Color | Type |\n' | ||
'|:-----------|:-----:|----------:|\n' | ||
'| Avocado | green | nut |\n' | ||
'| Tomato | red | fruit |\n' | ||
'| Lettuce | green | vegetable |\n' | ||
'| Watermelon | green | |\n' | ||
'| | | |' | ||
) | ||
assert actual == expected | ||
|
||
|
||
def test_multi_line(): | ||
"""Test multi-lined cells.""" | ||
table_data = [ | ||
['Show', 'Characters'], | ||
['Rugrats', 'Tommy Pickles, Chuckie Finster, Phillip DeVille, Lillian DeVille, Angelica Pickles,\nDil Pickles'], | ||
['South Park', 'Stan Marsh, Kyle Broflovski, Eric Cartman, Kenny McCormick'] | ||
] | ||
table = GithubFlavoredMarkdownTable(table_data) | ||
|
||
# Test defaults. | ||
actual = table.table | ||
expected = ( | ||
'| Show | Characters |\n' | ||
'|------------|-------------------------------------------------------------------------------------|\n' | ||
'| Rugrats | Tommy Pickles, Chuckie Finster, Phillip DeVille, Lillian DeVille, Angelica Pickles, |\n' | ||
'| | Dil Pickles |\n' | ||
'| South Park | Stan Marsh, Kyle Broflovski, Eric Cartman, Kenny McCormick |' | ||
) | ||
assert actual == expected | ||
|
||
# Test inner row border. | ||
table.inner_row_border = True | ||
actual = table.table | ||
expected = ( | ||
'| Show | Characters |\n' | ||
'|------------|-------------------------------------------------------------------------------------|\n' | ||
'| Rugrats | Tommy Pickles, Chuckie Finster, Phillip DeVille, Lillian DeVille, Angelica Pickles, |\n' | ||
'| | Dil Pickles |\n' | ||
'| South Park | Stan Marsh, Kyle Broflovski, Eric Cartman, Kenny McCormick |' | ||
) | ||
assert actual == expected | ||
|
||
# Justify right. | ||
table.justify_columns = {1: 'right'} | ||
actual = table.table | ||
expected = ( | ||
'| Show | Characters |\n' | ||
'|------------|------------------------------------------------------------------------------------:|\n' | ||
'| Rugrats | Tommy Pickles, Chuckie Finster, Phillip DeVille, Lillian DeVille, Angelica Pickles, |\n' | ||
'| | Dil Pickles |\n' | ||
'| South Park | Stan Marsh, Kyle Broflovski, Eric Cartman, Kenny McCormick |' | ||
) | ||
assert actual == expected |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.