mirror of https://github.com/Textualize/rich.git
refactoring test_box_substitute: smaller and focused tests are better than large ones
This commit is contained in:
parent
f65770dd0d
commit
23a3f9e620
|
@ -48,7 +48,26 @@ def test_get_bottom():
|
|||
assert bottom == "┗━┻━━┻━━━┛"
|
||||
|
||||
|
||||
def test_box_substitute():
|
||||
def test_box_substitute_for_same_box():
|
||||
options = ConsoleOptions(
|
||||
ConsoleDimensions(80, 25),
|
||||
legacy_windows=False,
|
||||
min_width=1,
|
||||
max_width=100,
|
||||
is_terminal=True,
|
||||
encoding="utf-8",
|
||||
max_height=25,
|
||||
)
|
||||
|
||||
assert ROUNDED.substitute(options) == ROUNDED
|
||||
assert MINIMAL_HEAVY_HEAD.substitute(options) == MINIMAL_HEAVY_HEAD
|
||||
assert SIMPLE_HEAVY.substitute(options) == SIMPLE_HEAVY
|
||||
assert HEAVY.substitute(options) == HEAVY
|
||||
assert HEAVY_EDGE.substitute(options) == HEAVY_EDGE
|
||||
assert HEAVY_HEAD.substitute(options) == HEAVY_HEAD
|
||||
|
||||
|
||||
def test_box_substitute_for_different_box_legacy_windows():
|
||||
options = ConsoleOptions(
|
||||
ConsoleDimensions(80, 25),
|
||||
legacy_windows=True,
|
||||
|
@ -59,7 +78,6 @@ def test_box_substitute():
|
|||
max_height=25,
|
||||
)
|
||||
|
||||
# A different Box due to legacy_windows
|
||||
assert ROUNDED.substitute(options) == SQUARE
|
||||
assert MINIMAL_HEAVY_HEAD.substitute(options) == MINIMAL
|
||||
assert SIMPLE_HEAVY.substitute(options) == SIMPLE
|
||||
|
@ -67,17 +85,18 @@ def test_box_substitute():
|
|||
assert HEAVY_EDGE.substitute(options) == SQUARE
|
||||
assert HEAVY_HEAD.substitute(options) == SQUARE
|
||||
|
||||
# The same box
|
||||
options.legacy_windows = False
|
||||
assert ROUNDED.substitute(options) == ROUNDED
|
||||
assert MINIMAL_HEAVY_HEAD.substitute(options) == MINIMAL_HEAVY_HEAD
|
||||
assert SIMPLE_HEAVY.substitute(options) == SIMPLE_HEAVY
|
||||
assert HEAVY.substitute(options) == HEAVY
|
||||
assert HEAVY_EDGE.substitute(options) == HEAVY_EDGE
|
||||
assert HEAVY_HEAD.substitute(options) == HEAVY_HEAD
|
||||
|
||||
# A different Box due to ascii encoding
|
||||
options.encoding = "ascii"
|
||||
def test_box_substitute_for_different_box_ascii_encoding():
|
||||
options = ConsoleOptions(
|
||||
ConsoleDimensions(80, 25),
|
||||
legacy_windows=True,
|
||||
min_width=1,
|
||||
max_width=100,
|
||||
is_terminal=True,
|
||||
encoding="ascii",
|
||||
max_height=25,
|
||||
)
|
||||
|
||||
assert ROUNDED.substitute(options) == ASCII
|
||||
assert MINIMAL_HEAVY_HEAD.substitute(options) == ASCII
|
||||
assert SIMPLE_HEAVY.substitute(options) == ASCII
|
||||
|
|
Loading…
Reference in New Issue