Files
tableprint/tests/test_functions.py
2016-10-07 13:17:38 -07:00

27 lines
731 B
Python

# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from tableprint import top, bottom, row
import pytest
def test_borders():
# top
assert top(5, width=2, style='round') == '╭──┬──┬──┬──┬──╮'
assert top(1, width=6, style='grid') == '+------+'
# bottom
assert bottom(3, width=1, style='fancy_grid') == '╘═╧═╧═╛'
assert bottom(3, 4, style='clean') == ' ──── ──── ──── '
def test_row():
# valid
assert row("abc", width=3, style='round') == '│ a│ b│ c│'
assert row([1, 2, 3], width=3, style='clean') == ' 1 2 3 '
# invalid
with pytest.raises(ValueError) as context:
row([{}])