mirror of
https://github.com/KevinMidboe/tableprint.git
synced 2025-12-08 20:39:08 +00:00
Adds a small test for the hr() function
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
from tableprint import table, banner, dataframe
|
from tableprint import table, banner, dataframe, hr
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
@@ -7,7 +7,7 @@ import numpy as np
|
|||||||
def test_table():
|
def test_table():
|
||||||
|
|
||||||
output = StringIO()
|
output = StringIO()
|
||||||
table([[1, 2, 3], [4, 5 ,6]], "ABC", style='round', width=5, out=output)
|
table([[1, 2, 3], [4, 5, 6]], 'ABC', style='round', width=5, out=output)
|
||||||
assert output.getvalue() == '╭─────┬─────┬─────╮\n│ A │ B │ C │\n├─────┼─────┼─────┤\n│ 1│ 2│ 3│\n│ 4│ 5│ 6│\n╰─────┴─────┴─────╯\n'
|
assert output.getvalue() == '╭─────┬─────┬─────╮\n│ A │ B │ C │\n├─────┼─────┼─────┤\n│ 1│ 2│ 3│\n│ 4│ 5│ 6│\n╰─────┴─────┴─────╯\n'
|
||||||
|
|
||||||
output = StringIO()
|
output = StringIO()
|
||||||
@@ -41,3 +41,10 @@ def test_banner():
|
|||||||
output = StringIO()
|
output = StringIO()
|
||||||
banner('!', style='banner', width=1, out=output)
|
banner('!', style='banner', width=1, out=output)
|
||||||
assert output.getvalue() == '╒═╕\n│!│\n╘═╛\n'
|
assert output.getvalue() == '╒═╕\n│!│\n╘═╛\n'
|
||||||
|
|
||||||
|
|
||||||
|
def test_hr():
|
||||||
|
|
||||||
|
output = hr(1, width=11)
|
||||||
|
assert len(output) == 11
|
||||||
|
assert '───────────'
|
||||||
|
|||||||
Reference in New Issue
Block a user