diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2011-05-14 03:38:03 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2011-05-14 03:38:03 (GMT) |
commit | 3c0d8a1cc728a92671a9f3d4cbf6636453707385 (patch) | |
tree | 8aa66aa9741888b7613c518664f607308aa1670a /Lib/json/tests/test_dump.py | |
parent | fec3ad103613b46c9821f210581efca6fedcb9a9 (diff) | |
download | cpython-3c0d8a1cc728a92671a9f3d4cbf6636453707385.zip cpython-3c0d8a1cc728a92671a9f3d4cbf6636453707385.tar.gz cpython-3c0d8a1cc728a92671a9f3d4cbf6636453707385.tar.bz2 |
#5723: Improve json tests to be executed with and without accelerations.
Diffstat (limited to 'Lib/json/tests/test_dump.py')
-rw-r--r-- | Lib/json/tests/test_dump.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/Lib/json/tests/test_dump.py b/Lib/json/tests/test_dump.py index 8df234b..6f5262b 100644 --- a/Lib/json/tests/test_dump.py +++ b/Lib/json/tests/test_dump.py @@ -1,21 +1,24 @@ -from unittest import TestCase from io import StringIO +from json.tests import PyTest, CTest -import json -class TestDump(TestCase): +class TestDump: def test_dump(self): sio = StringIO() - json.dump({}, sio) + self.json.dump({}, sio) self.assertEqual(sio.getvalue(), '{}') def test_dumps(self): - self.assertEqual(json.dumps({}), '{}') + self.assertEqual(self.dumps({}), '{}') def test_encode_truefalse(self): - self.assertEqual(json.dumps( + self.assertEqual(self.dumps( {True: False, False: True}, sort_keys=True), '{"false": true, "true": false}') - self.assertEqual(json.dumps( + self.assertEqual(self.dumps( {2: 3.0, 4.0: 5, False: 1, 6: True}, sort_keys=True), '{"false": 1, "2": 3.0, "4.0": 5, "6": true}') + + +class TestPyDump(TestDump, PyTest): pass +class TestCDump(TestDump, CTest): pass |