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/rich/pretty.py
+++ b/rich/pretty.py
@@ -676,7 +676,10 @@ def traverse(
append = children.append
if reached_max_depth:
- node = Node(value_repr=f"...")
+ if angular:
+ node = Node(value_repr=f"<{class_name}...>")
+ else:
+ node = Node(value_repr=f"{class_name}(...)")
else:
if angular:
node = Node(
@@ -718,7 +721,7 @@ def traverse(
attr_fields = _get_attr_fields(obj)
if attr_fields:
if reached_max_depth:
- node = Node(value_repr=f"...")
+ node = Node(value_repr=f"{obj.__class__.__name__}(...)")
else:
node = Node(
open_brace=f"{obj.__class__.__name__}(",
@@ -774,7 +777,7 @@ def traverse(
children = []
append = children.append
if reached_max_depth:
- node = Node(value_repr=f"...")
+ node = Node(value_repr=f"{obj.__class__.__name__}(...)")
else:
node = Node(
open_brace=f"{obj.__class__.__name__}(",
@@ -794,18 +797,21 @@ def traverse(
pop_visited(obj_id)
elif _is_namedtuple(obj) and _has_default_namedtuple_repr(obj):
+ class_name = obj.__class__.__name__
if reached_max_depth:
- node = Node(value_repr="...")
+ # If we've reached the max depth, we still show the class name, but not its contents
+ node = Node(
+ value_repr=f"{class_name}(...)",
+ )
else:
children = []
- class_name = obj.__class__.__name__
+ append = children.append
node = Node(
open_brace=f"{class_name}(",
close_brace=")",
children=children,
empty=f"{class_name}()",
)
- append = children.append
for last, (key, value) in loop_last(obj._asdict().items()):
child_node = _traverse(value, depth=depth + 1)
child_node.key_repr = key
@@ -827,7 +833,7 @@ def traverse(
open_brace, close_brace, empty = _BRACES[obj_type](obj)
if reached_max_depth:
- node = Node(value_repr=f"...", last=root)
+ node = Node(value_repr=f"{open_brace}...{close_brace}")
elif obj_type.__repr__ != type(obj).__repr__:
node = Node(value_repr=to_repr(obj), last=root)
elif obj:
........F
=================================== FAILURES ===================================
____________________________ test_pretty_dataclass _____________________________
def test_pretty_dataclass():
dc = ExampleDataclass(1000, "Hello, World", 999, ["foo", "bar", "baz"])
result = pretty_repr(dc, max_width=80)
print(repr(result))
assert (
result
== "ExampleDataclass(foo=1000, bar='Hello, World', baz=['foo', 'bar', 'baz'])"
)
result = pretty_repr(dc, max_width=16)
print(repr(result))
> assert (
result
== "ExampleDataclass(\n foo=1000,\n bar='Hello, World',\n baz=[\n 'foo',\n 'bar',\n 'baz'\n ]\n)"
)
E assert "ExampleDatac...bar', 'baz'])" == "ExampleDatac...az'\n ]\n)"
E
E + ExampleDataclass(foo=1000, bar='Hello, World', baz=['foo', 'bar', 'baz'])
E - ExampleDataclass(
E - foo=1000,
E - bar='Hello, World',
E - baz=[
E - 'foo',...
E
E ...Full output truncated (4 lines hidden), use '-vv' to show
tests/test_pretty.py:184: AssertionError
----------------------------- Captured stdout call -----------------------------
"ExampleDataclass(foo=1000, bar='Hello, World', baz=['foo', 'bar', 'baz'])"
"ExampleDataclass(foo=1000, bar='Hello, World', baz=['foo', 'bar', 'baz'])"
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
1 failed, 8 passed in 0.15s