Skip to content

Commit

Permalink
tests: test tabulate()
Browse files Browse the repository at this point in the history
  • Loading branch information
zopieux authored and seirl committed Mar 26, 2017
1 parent f2c1ded commit 3254244
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from camisole.utils import uniquify, indent, parse_size, parse_float
from camisole.utils import uniquify, indent, parse_size, parse_float, tabulate


def test_uniquify():
Expand Down Expand Up @@ -29,3 +29,22 @@ def test_parse_size():
def test_parse_float():
assert parse_float('0.1') == 0.1
assert parse_float(None) is None


def test_tabulate():
rows = [['foo', 'a'], ['barbar', 'baz'], ]
assert '\n'.join(tabulate(rows, margin=0)) == (
'foo | a \n'
'barbar | baz'
)

assert '\n'.join(tabulate(rows, margin=1)) == (
'foo | a \n'
'barbar | baz '
)

assert '\n'.join(tabulate(rows, headers=['FOO', 'BARBAZZZ'], margin=0)) == (
'FOO | BARBAZZZ\n'
'foo | a \n'
'barbar | baz '
)

0 comments on commit 3254244

Please sign in to comment.