mirror of https://github.com/Textualize/rich.git
test fix
This commit is contained in:
parent
3936debf0c
commit
fd7b32603c
|
@ -1005,7 +1005,8 @@ class Console:
|
||||||
width: Optional[int] = None
|
width: Optional[int] = None
|
||||||
height: Optional[int] = None
|
height: Optional[int] = None
|
||||||
|
|
||||||
for file_descriptor in _STD_STREAMS_OUTPUT if WINDOWS else _STD_STREAMS:
|
streams = _STD_STREAMS_OUTPUT if WINDOWS else _STD_STREAMS
|
||||||
|
for file_descriptor in streams:
|
||||||
try:
|
try:
|
||||||
width, height = os.get_terminal_size(file_descriptor)
|
width, height = os.get_terminal_size(file_descriptor)
|
||||||
except (AttributeError, ValueError, OSError): # Probably not a terminal
|
except (AttributeError, ValueError, OSError): # Probably not a terminal
|
||||||
|
|
|
@ -111,6 +111,7 @@ def test_title_text() -> None:
|
||||||
console = Console(
|
console = Console(
|
||||||
file=io.StringIO(),
|
file=io.StringIO(),
|
||||||
width=50,
|
width=50,
|
||||||
|
height=20,
|
||||||
legacy_windows=False,
|
legacy_windows=False,
|
||||||
force_terminal=True,
|
force_terminal=True,
|
||||||
color_system="truecolor",
|
color_system="truecolor",
|
||||||
|
@ -119,7 +120,7 @@ def test_title_text() -> None:
|
||||||
|
|
||||||
result = console.file.getvalue()
|
result = console.file.getvalue()
|
||||||
print(repr(result))
|
print(repr(result))
|
||||||
expected = "╭───────────────────────────────────\x1b[31m title \x1b[0m────────────────────────────────────╮\n│ Hello, World │\n╰──────────────────────────────────\x1b[1;35m subtitle \x1b[0m──────────────────────────────────╯\n"
|
expected = "╭────────────────────\x1b[31m title \x1b[0m─────────────────────╮\n│ Hello, World │\n╰───────────────────\x1b[1;35m subtitle \x1b[0m───────────────────╯\n"
|
||||||
assert result == expected
|
assert result == expected
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue