add tests (rule.py coverage 100% now)

This commit is contained in:
Hedy Li 2020-08-05 09:38:02 +00:00
parent b698b8d6d2
commit e0066e34c2
1 changed files with 18 additions and 3 deletions

View File

@ -27,7 +27,20 @@ def test_rule():
# doesn't work for now
def test_rule_cjk():
# def test_rule_cjk():
# console = Console(
# width=16,
# file=io.StringIO(),
# force_terminal=True,
# color_system=None,
# legacy_windows=False,
# )
# console.rule("欢迎!")
# expected = "──── 欢迎! ────\n"
# assert console.file.getvalue() == expected
def test_characters():
console = Console(
width=16,
file=io.StringIO(),
@ -35,8 +48,10 @@ def test_rule_cjk():
color_system=None,
legacy_windows=False,
)
console.rule("欢迎!")
expected = "──── 欢迎! ────\n"
console.rule(characters="+*")
console.rule("foo", characters="+*")
expected = "+*+*+*+*+*+*+*+*\n"
expected += "+*+*+ foo +*+*++\n"
assert console.file.getvalue() == expected