1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
from textual.css.scalar import Scalar, Unit
def test_copy_with_value():
old = Scalar(1, Unit.HEIGHT, Unit.CELLS)
new = old.copy_with(value=2)
assert new == Scalar(2, Unit.HEIGHT, Unit.CELLS)
def test_copy_with_unit():
old = Scalar(1, Unit.HEIGHT, Unit.CELLS)
new = old.copy_with(unit=Unit.WIDTH)
assert new == Scalar(1, Unit.WIDTH, Unit.CELLS)
def test_copy_with_percent_unit():
old = Scalar(1, Unit.HEIGHT, Unit.CELLS)
new = old.copy_with(percent_unit=Unit.FRACTION)
assert new == Scalar(1, Unit.HEIGHT, Unit.FRACTION)
|