File: test_scalar.py

package info (click to toggle)
textual 2.1.2-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 55,080 kB
  • sloc: python: 85,423; lisp: 1,669; makefile: 101
file content (19 lines) | stat: -rw-r--r-- 562 bytes parent folder | download | duplicates (2)
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)