Skip to content

Commit 6928a37

Browse files
committed
dict key loads() tests
1 parent 568c245 commit 6928a37

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

test/test_type.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def test_infinity(self):
126126

127127
def test_int_64(self):
128128
"""
129-
int 64-bit
129+
int 64-bit
130130
"""
131131
for val in (9223372036854775807, -9223372036854775807):
132132
self.assertEqual(orjson.loads(str(val)), val)
@@ -209,11 +209,20 @@ def test_dict_large(self):
209209
self.assertEqual(len(obj), 513)
210210
self.assertEqual(orjson.loads(orjson.dumps(obj)), obj)
211211

212-
def test_dict_invalid_key(self):
212+
def test_dict_invalid_key_dumps(self):
213213
"""
214-
dict invalid key
214+
dict invalid key dumps()
215215
"""
216216
with self.assertRaises(orjson.JSONEncodeError):
217217
orjson.dumps({1: 'value'})
218218
with self.assertRaises(orjson.JSONEncodeError):
219219
orjson.dumps({b'key': 'value'})
220+
221+
def test_dict_invalid_key_loads(self):
222+
"""
223+
dict invalid key dumps()
224+
"""
225+
with self.assertRaises(orjson.JSONDecodeError):
226+
orjson.loads('{1:"value"}')
227+
with self.assertRaises(orjson.JSONDecodeError):
228+
orjson.loads('{{"a":true}:true}')

0 commit comments

Comments
 (0)