mirror of
https://github.com/KevinMidboe/tableprint.git
synced 2025-12-08 20:39:08 +00:00
Adds test suite for tableprint
This commit is contained in:
26
tests/test_functions.py
Normal file
26
tests/test_functions.py
Normal file
@@ -0,0 +1,26 @@
|
||||
# -*- 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([{}])
|
||||
Reference in New Issue
Block a user