Skip to content

Commit 5f08960

Browse files
committed
Fix test case, remove unnecessary recursion on dataclass (we aren't testing that in the particular unit test)
1 parent 0b8fd2b commit 5f08960

File tree

2 files changed

+1
-7
lines changed

2 files changed

+1
-7
lines changed

Lib/pprint.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,6 @@ def _pprint_dataclass(self, object, stream, indent, allowance, context, level):
234234
items = [(f.name, getattr(object, f.name)) for f in dataclass_fields(object) if f.repr]
235235
stream.write(self._format_block_start(cls_name + '(', indent))
236236
self._format_namespace_items(items, stream, indent, allowance, context, level)
237-
if self._block_style:
238-
stream.write('\n')
239237
stream.write(self._format_block_end(')', indent - self._indent_per_level))
240238

241239
_dispatch = {}

Lib/test/test_pprint.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,7 +1142,6 @@ class DummyDataclass:
11421142
quux: list = field(default_factory=list)
11431143
corge: int = 1
11441144
garply: tuple = (1, 2, 3, 4)
1145-
waldo: "DummyDataclass" | None = None
11461145
dummy_dataclass = DummyDataclass(
11471146
foo="foo",
11481147
bar=1.2,
@@ -1151,7 +1150,6 @@ class DummyDataclass:
11511150
quux=["foo", "bar", "baz"],
11521151
corge=7,
11531152
garply=(1, 2, 3, 4),
1154-
waldo=None,
11551153
)
11561154

11571155
dummy_dict = {
@@ -1299,9 +1297,7 @@ def __init__(self, *args, **kwargs):
12991297
qux={'foo': 'bar', 'baz': 123},
13001298
quux=['foo', 'bar', 'baz'],
13011299
corge=7,
1302-
garply=(1, 2, 3, 4),
1303-
waldo=None
1304-
1300+
garply=(1, 2, 3, 4)
13051301
),
13061302
'dummy_dict': {
13071303
'foo': 'bar',

0 commit comments

Comments
 (0)