This commit is contained in:
Will McGugan 2020-04-26 16:28:18 +01:00
parent a590002dc3
commit c9d148410e
4 changed files with 72 additions and 63 deletions

17
tests/test_padding.py Normal file
View file

@ -0,0 +1,17 @@
import pytest
from rich.padding import Padding
def test_repr():
padding = Padding("foo", (1, 2))
assert isinstance(repr(padding), str)
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))