← baseline_full_v2

rich_3882

failed NO_PATCH NO_PATCH UNSUBMITTED empty_patch(None) · None tool calls · 0 s · Textualize/rich

Task input

Fix raw markup printed on prompt errors sometimes

## Type of changes

- [x] Bug fix
- [ ] New feature
- [ ] Documentation / docstrings
- [ ] Tests
- [ ] Other

## Checklist

- [x] I've run the latest [black](https://github.com/psf/black) with default args on new code.
- [ ] I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate (see note about typos above).
- [x] I've added tests for new code.
- [x] I accept that @willmcgugan may be pedantic in the code review.

## Description

PromptBase.on_validate_error() should explicitly ask for markup in case the console passed to it has markup disabled globally.

Fixes #3881.

Tool calls (0)

#ToolArgumentsResult
No trace captured.

Test output

show
.......F
=================================== FAILURES ===================================
__________________________ test_prompt_confirm_markup __________________________

    def test_prompt_confirm_markup():
        INPUT = "foo\nNO\ny"
        console = Console(file=io.StringIO(), markup=False)
        answer = Confirm.ask(
            "continue", console=console, stream=io.StringIO(INPUT), default=True
        )
        assert answer is True
        expected = "continue [y/n] (y): Please enter Y or N\ncontinue [y/n] (y): Please enter Y or N\ncontinue [y/n] (y): "
        output = console.file.getvalue()
        print(repr(output))
>       assert output == expected
E       AssertionError: assert 'continue [y/...e [y/n] (y): ' == 'continue [y/...e [y/n] (y): '
E         
E         - continue [y/n] (y): Please enter Y or N
E         + continue [y/n] (y): [prompt.invalid]Please enter Y or N
E         ?                     ++++++++++++++++
E         - continue [y/n] (y): Please enter Y or N
E         + continue [y/n] (y): [prompt.invalid]Please enter Y or N
E         ?                     ++++++++++++++++
E           continue [y/n] (y):

tests/test_prompt.py:126: AssertionError
----------------------------- Captured stdout call -----------------------------
'continue [y/n] (y): [prompt.invalid]Please enter Y or N\ncontinue [y/n] (y): [prompt.invalid]Please enter Y or N\ncontinue [y/n] (y): '
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
1 failed, 7 passed in 0.12s