Re-print the ordered dict as a normal dict
This commit is contained in:
parent
55a78b6973
commit
ccfb6691df
|
@ -178,7 +178,7 @@ class PrettyPrinter:
|
|||
return
|
||||
cls = object.__class__
|
||||
stream.write(cls.__name__ + "(")
|
||||
self._format(list(object.items()), stream, indent, allowance, context, level)
|
||||
self._pprint_dict(object, stream, indent, allowance, context, level)
|
||||
stream.write(")")
|
||||
|
||||
_dispatch[_collections.OrderedDict.__repr__] = _pprint_ordered_dict
|
||||
|
|
|
@ -84,28 +84,19 @@ class DataclassWithTwoItems:
|
|||
pytest.param(
|
||||
OrderedDict({"one": 1}),
|
||||
"""
|
||||
OrderedDict([
|
||||
(
|
||||
'one',
|
||||
1,
|
||||
),
|
||||
])
|
||||
OrderedDict({
|
||||
'one': 1,
|
||||
})
|
||||
""",
|
||||
id="ordereddict-one-item",
|
||||
),
|
||||
pytest.param(
|
||||
OrderedDict({"one": 1, "two": 2}),
|
||||
"""
|
||||
OrderedDict([
|
||||
(
|
||||
'one',
|
||||
1,
|
||||
),
|
||||
(
|
||||
'two',
|
||||
2,
|
||||
),
|
||||
])
|
||||
OrderedDict({
|
||||
'one': 1,
|
||||
'two': 2,
|
||||
})
|
||||
""",
|
||||
id="ordereddict-two-items",
|
||||
),
|
||||
|
@ -389,16 +380,10 @@ class DataclassWithTwoItems:
|
|||
'one': 1,
|
||||
'two': 2,
|
||||
}),
|
||||
'ordereddict': OrderedDict([
|
||||
(
|
||||
'one',
|
||||
1,
|
||||
),
|
||||
(
|
||||
'two',
|
||||
2,
|
||||
),
|
||||
]),
|
||||
'ordereddict': OrderedDict({
|
||||
'one': 1,
|
||||
'two': 2,
|
||||
}),
|
||||
'set': {
|
||||
1,
|
||||
2,
|
||||
|
|
Loading…
Reference in New Issue