bpo-37805: Add tests for json.dump(..., skipkeys=True) (GH-15489)
https://bugs.python.org/issue37805 Automerge-Triggered-By: @methane
This commit is contained in:
parent
6b16d938d6
commit
44cd86bbdd
|
@ -12,6 +12,16 @@ class TestDump:
|
|||
def test_dumps(self):
|
||||
self.assertEqual(self.dumps({}), '{}')
|
||||
|
||||
def test_dump_skipkeys(self):
|
||||
v = {b'invalid_key': False, 'valid_key': True}
|
||||
with self.assertRaises(TypeError):
|
||||
self.json.dumps(v)
|
||||
|
||||
s = self.json.dumps(v, skipkeys=True)
|
||||
o = self.json.loads(s)
|
||||
self.assertIn('valid_key', o)
|
||||
self.assertNotIn(b'invalid_key', o)
|
||||
|
||||
def test_encode_truefalse(self):
|
||||
self.assertEqual(self.dumps(
|
||||
{True: False, False: True}, sort_keys=True),
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Add tests for json.dump(..., skipkeys=True). Patch by Dong-hee Na.
|
Loading…
Reference in New Issue