mirror of
https://github.com/python/cpython.git
synced 2025-11-01 06:01:29 +00:00
gh-131884: Fix incorrect formatting in json.dumps() when using indent and skipkeys=True (GH-132200)
This commit is contained in:
parent
485b499610
commit
ec12559eba
4 changed files with 20 additions and 7 deletions
|
|
@ -22,6 +22,14 @@ def test_dump_skipkeys(self):
|
|||
self.assertIn('valid_key', o)
|
||||
self.assertNotIn(b'invalid_key', o)
|
||||
|
||||
def test_dump_skipkeys_indent_empty(self):
|
||||
v = {b'invalid_key': False}
|
||||
self.assertEqual(self.json.dumps(v, skipkeys=True, indent=4), '{}')
|
||||
|
||||
def test_skipkeys_indent(self):
|
||||
v = {b'invalid_key': False, 'valid_key': True}
|
||||
self.assertEqual(self.json.dumps(v, skipkeys=True, indent=4), '{\n "valid_key": true\n}')
|
||||
|
||||
def test_encode_truefalse(self):
|
||||
self.assertEqual(self.dumps(
|
||||
{True: False, False: True}, sort_keys=True),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue