Skip to content

Commit

Permalink
test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Oct 1, 2024
1 parent 3936deb commit fd7b326
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion rich/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,8 @@ def size(self) -> ConsoleDimensions:
width: 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:
width, height = os.get_terminal_size(file_descriptor)
except (AttributeError, ValueError, OSError): # Probably not a terminal
Expand Down
3 changes: 2 additions & 1 deletion tests/test_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def test_title_text() -> None:
console = Console(
file=io.StringIO(),
width=50,
height=20,
legacy_windows=False,
force_terminal=True,
color_system="truecolor",
Expand All @@ -119,7 +120,7 @@ def test_title_text() -> None:

result = console.file.getvalue()
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


Expand Down

0 comments on commit fd7b326

Please sign in to comment.