failed NO_PATCH NO_PATCH UNSUBMITTED empty_patch(None) · None tool calls · 0 s · Textualize/rich
(not found in data/tasks.jsonl)
| # | Tool | Arguments | Result |
|---|---|---|---|
| No trace captured. | |||
............F
=================================== FAILURES ===================================
_ test_size_can_fall_back_to_std_descriptors[False-ValueError-ValueError-ValueError-stderr_size4-expected_size4] _
get_terminal_size_mock = <MagicMock name='get_terminal_size' id='4347503888'>
is_windows = False, no_descriptor_size = <class 'ValueError'>
stdin_size = <class 'ValueError'>, stdout_size = <class 'ValueError'>
stderr_size = (133, 24), expected_size = (133, 24)
@pytest.mark.parametrize(
"is_windows,no_descriptor_size,stdin_size,stdout_size,stderr_size,expected_size",
[
# on Windows we'll use `os.get_terminal_size()` without arguments...
(True, (133, 24), ValueError, ValueError, ValueError, (133, 24)),
(False, (133, 24), ValueError, ValueError, ValueError, (80, 25)),
# ...while on other OS we'll try to pass stdin, then stdout, then stderr to it:
(False, ValueError, (133, 24), ValueError, ValueError, (133, 24)),
(False, ValueError, ValueError, (133, 24), ValueError, (133, 24)),
(False, ValueError, ValueError, ValueError, (133, 24), (133, 24)),
(False, ValueError, ValueError, ValueError, ValueError, (80, 25)),
],
)
@mock.patch("rich.console.os.get_terminal_size")
def test_size_can_fall_back_to_std_descriptors(
get_terminal_size_mock: mock.MagicMock,
is_windows: bool,
no_descriptor_size: Union[Tuple[int, int], Type[ValueError]],
stdin_size: Union[Tuple[int, int], Type[ValueError]],
stdout_size: Union[Tuple[int, int], Type[ValueError]],
stderr_size: Union[Tuple[int, int], Type[ValueError]],
expected_size,
):
def get_terminal_size_mock_impl(fileno: int = None) -> Tuple[int, int]:
value = {
None: no_descriptor_size,
sys.__stdin__.fileno(): stdin_size,
sys.__stdout__.fileno(): stdout_size,
sys.__stderr__.fileno(): stderr_size,
}[fileno]
if value is ValueError:
raise value
return value
get_terminal_size_mock.side_effect = get_terminal_size_mock_impl
console = Console(legacy_windows=False)
with mock.patch("rich.console.WINDOWS", new=is_windows):
w, h = console.size
> assert (w, h) == expected_size
E assert (80, 25) == (133, 24)
E
E At index 0 diff: 80 != 133
E Use -v to get more diff
tests/test_console.py:165: AssertionError
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
1 failed, 12 passed in 0.17s