8000 gh-100272: Fix JSON serialization of OrderedDict by serhiy-storchaka · Pull Request #100273 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-100272: Fix JSON serialization of OrderedDict #100273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 17, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add more items in the test.
  • Loading branch information
serhiy-storchaka committed Dec 17, 2022
commit 8e5b181bb307912429c63423ed7d1318048122ae
8 changes: 4 additions & 4 deletions Lib/test/test_json/test_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ def test_default(self):
self.dumps(repr(type)))

def test_ordereddict(self):
od = collections.OrderedDict(a=1, b=2)
od.move_to_end('a')
od = collections.OrderedDict(a=1, b=2, c=3, d=4)
od.move_to_end('b')
self.assertEqual(
self.dumps(od),
'{"b": 2, "a": 1}')
'{"a": 1, "c": 3, "d": 4, "b": 2}')
self.assertEqual(
self.dumps(od, sort_keys=True),
'{"a": 1, "b": 2}')
'{"a": 1, "b": 2, "c": 3, "d": 4}')


class TestPyDefault(TestDefault, PyTest): pass
Expand Down
0