Commit 44cd86bb authored by Dong-hee Na's avatar Dong-hee Na Committed by Miss Islington (bot)

bpo-37805: Add tests for json.dump(..., skipkeys=True) (GH-15489)



https://bugs.python.org/issue37805



Automerge-Triggered-By: @methane
parent 6b16d938
......@@ -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),
......
Add tests for json.dump(..., skipkeys=True). Patch by Dong-hee Na.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment