rich/tests/test_padding.py

22 lines
504 B
Python
Raw Normal View History

2020-04-26 15:28:18 +00:00
import pytest
from rich.padding import Padding
def test_repr():
padding = Padding("foo", (1, 2))
assert isinstance(repr(padding), str)
2020-10-08 09:07:30 +00:00
def test_indent():
assert Padding.indent("test", 4).left == 4
2020-04-26 15:28:18 +00:00
def test_unpack():
assert Padding.unpack(3) == (3, 3, 3, 3)
assert Padding.unpack((3,)) == (3, 3, 3, 3)
assert Padding.unpack((3, 4)) == (3, 4, 3, 4)
assert Padding.unpack((3, 4, 5, 6)) == (3, 4, 5, 6)
with pytest.raises(ValueError):
Padding.unpack((1, 2, 3))