Improved dump tests.

This commit is contained in:
Fabio Caccamo 2020-02-20 11:41:26 +01:00
parent e3b0c115dc
commit a706708e04
1 changed files with 12 additions and 0 deletions

View File

@ -53,3 +53,15 @@ class dump_test_case(unittest.TestCase):
}""" }"""
o = _dump(d) o = _dump(d)
self.assertEqual(o, r) self.assertEqual(o, r)
def test_dump_with_unsortable_keys(self):
d = {
None: None,
0: 0,
1: 1,
}
# must not raise TypeError
_dump(d)
d['dt'] = dt
with self.assertRaises(TypeError):
o = _dump(d, sort_keys=False, default=None)