failed WRONG_FIX UNSUBMITTED wrong_fix_unsubmitted(None) · None tool calls · 0 s · Textualize/rich
(not found in data/tasks.jsonl)
| # | Tool | Arguments | Result |
|---|---|---|---|
| No trace captured. | |||
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Environment variables `JUPYTER_COLUMNS` and `JUPYTER_LINES` to control width and height of console in Jupyter
+- `inspect` will prefix coroutine functions with `async def`
### Changed
--- a/rich/_inspect.py
+++ b/rich/_inspect.py
@@ -107,11 +107,13 @@ class Inspect(JupyterMixin):
# If obj is a module, there may be classes (which are callable) to display
if inspect.isclass(obj):
prefix = "class"
+ elif inspect.iscoroutinefunction(obj):
+ prefix = "async def"
else:
prefix = "def"
qual_signature = Text.assemble(
- (f"{prefix} ", f"inspect.{prefix}"),
+ (f"{prefix} ", f"inspect.{prefix.replace(' ', '_')}"),
(qualname, "inspect.callable"),
signature_text,
)
--- a/rich/default_styles.py
+++ b/rich/default_styles.py
@@ -39,6 +39,7 @@ DEFAULT_STYLES: Dict[str, Style] = {
"inspect.attr": Style(color="yellow", italic=True),
"inspect.attr.dunder": Style(color="yellow", italic=True, dim=True),
"inspect.callable": Style(bold=True, color="red"),
+ "inspect.async_def": Style(italic=True, color="bright_cyan"),
"inspect.def": Style(italic=True, color="bright_cyan"),
"inspect.class": Style(italic=True, color="bright_cyan"),
"inspect.error": Style(bold=True, color="red"),
.F
=================================== FAILURES ===================================
______________________________ test_inspect_text _______________________________
@skip_pypy3
def test_inspect_text():
expected = (
"╭──────────────── <class 'str'> ─────────────────╮\n"
"│ str(object='') -> str │\n"
"│ str(bytes_or_buffer[, encoding[, errors]]) -> │\n"
"│ str │\n"
"│ │\n"
"│ 33 attribute(s) not shown. Run │\n"
"│ inspect(inspect) for options. │\n"
"╰────────────────────────────────────────────────╯\n"
)
print(repr(expected))
> assert expected == render("Hello")
E AssertionError: assert '╭───────────...──────────╯\n' == '╭───────────...──────────╯\n'
E
E Skipping 248 identical leading characters in diff, use -v to show
E Skipping 140 identical trailing characters in diff, use -v to show
E │
E - │ 34 attribut
E ? ^
E + │ 33 attribut
E ? ^
tests/test_inspect.py:102: AssertionError
----------------------------- Captured stdout call -----------------------------
"╭──────────────── <class 'str'> ─────────────────╮\n│ str(object='') -> str │\n│ str(bytes_or_buffer[, encoding[, errors]]) -> │\n│ str │\n│ │\n│ 33 attribute(s) not shown. Run │\n│ inspect(inspect) for options. │\n╰────────────────────────────────────────────────╯\n"
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
1 failed, 1 passed in 0.12s