diff options
author | Bob Ippolito <bob@redivi.com> | 2014-09-29 14:14:38 -0700 |
---|---|---|
committer | Bob Ippolito <bob@redivi.com> | 2014-09-29 14:14:38 -0700 |
commit | ccc8a2bc450f8b7f6db71a6daef4d4b069ba5851 (patch) | |
tree | 733ef8a1775b5a5b93b6b2750a6baa5f9614f92c | |
parent | 77437f037f99e9df49dab740b32bdb20af93af44 (diff) | |
download | simplejson-ccc8a2bc450f8b7f6db71a6daef4d4b069ba5851.tar.gz |
failing test for #106
-rw-r--r-- | simplejson/tests/test_dump.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/simplejson/tests/test_dump.py b/simplejson/tests/test_dump.py index 1d118d9..3661de0 100644 --- a/simplejson/tests/test_dump.py +++ b/simplejson/tests/test_dump.py @@ -119,3 +119,12 @@ class TestDump(TestCase): # the C API uses an accumulator that collects after 100,000 appends lst = [0] * 100000 self.assertEqual(json.loads(json.dumps(lst)), lst) + + def test_sort_keys(self): + # https://github.com/simplejson/simplejson/issues/106 + for num_keys in range(2, 32): + p = dict((str(x), x) for x in range(num_keys)) + sio = StringIO() + json.dump(p, sio, sort_keys=True) + self.assertEqual(sio.getvalue(), json.dumps(p, sort_keys=True)) + self.assertEqual(json.loads(sio.getvalue()), p) |