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
|
return
|
||||||
cls = object.__class__
|
cls = object.__class__
|
||||||
stream.write(cls.__name__ + "(")
|
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(")")
|
stream.write(")")
|
||||||
|
|
||||||
_dispatch[_collections.OrderedDict.__repr__] = _pprint_ordered_dict
|
_dispatch[_collections.OrderedDict.__repr__] = _pprint_ordered_dict
|
||||||
|
|
|
@ -84,28 +84,19 @@ class DataclassWithTwoItems:
|
||||||
pytest.param(
|
pytest.param(
|
||||||
OrderedDict({"one": 1}),
|
OrderedDict({"one": 1}),
|
||||||
"""
|
"""
|
||||||
OrderedDict([
|
OrderedDict({
|
||||||
(
|
'one': 1,
|
||||||
'one',
|
})
|
||||||
1,
|
|
||||||
),
|
|
||||||
])
|
|
||||||
""",
|
""",
|
||||||
id="ordereddict-one-item",
|
id="ordereddict-one-item",
|
||||||
),
|
),
|
||||||
pytest.param(
|
pytest.param(
|
||||||
OrderedDict({"one": 1, "two": 2}),
|
OrderedDict({"one": 1, "two": 2}),
|
||||||
"""
|
"""
|
||||||
OrderedDict([
|
OrderedDict({
|
||||||
(
|
'one': 1,
|
||||||
'one',
|
'two': 2,
|
||||||
1,
|
})
|
||||||
),
|
|
||||||
(
|
|
||||||
'two',
|
|
||||||
2,
|
|
||||||
),
|
|
||||||
])
|
|
||||||
""",
|
""",
|
||||||
id="ordereddict-two-items",
|
id="ordereddict-two-items",
|
||||||
),
|
),
|
||||||
|
@ -389,16 +380,10 @@ class DataclassWithTwoItems:
|
||||||
'one': 1,
|
'one': 1,
|
||||||
'two': 2,
|
'two': 2,
|
||||||
}),
|
}),
|
||||||
'ordereddict': OrderedDict([
|
'ordereddict': OrderedDict({
|
||||||
(
|
'one': 1,
|
||||||
'one',
|
'two': 2,
|
||||||
1,
|
}),
|
||||||
),
|
|
||||||
(
|
|
||||||
'two',
|
|
||||||
2,
|
|
||||||
),
|
|
||||||
]),
|
|
||||||
'set': {
|
'set': {
|
||||||
1,
|
1,
|
||||||
2,
|
2,
|
||||||
|
|
Loading…
Reference in New Issue