From a706708e04a3a6bf4f75fa1c0a03cd8dcaa7e9c9 Mon Sep 17 00:00:00 2001 From: Fabio Caccamo Date: Thu, 20 Feb 2020 11:41:26 +0100 Subject: [PATCH] Improved dump tests. --- tests/core/test_dump.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/core/test_dump.py b/tests/core/test_dump.py index 7e92648..9a1cec6 100644 --- a/tests/core/test_dump.py +++ b/tests/core/test_dump.py @@ -53,3 +53,15 @@ class dump_test_case(unittest.TestCase): }""" o = _dump(d) 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)