summaryrefslogtreecommitdiffstats
path: root/Lib/test/json_tests/test_fail.py
diff options
context:
space:
mode:
authorEzio Melotti <none@none>2011-05-14 03:47:51 (GMT)
committerEzio Melotti <none@none>2011-05-14 03:47:51 (GMT)
commit6b60fb9148738de1525bbf5c7ddadc16a474c635 (patch)
treee720267d24b84f52de329af4415057e9335917e4 /Lib/test/json_tests/test_fail.py
parent3659f27ad37f992fadc1692137edf32c01c5bc66 (diff)
downloadcpython-6b60fb9148738de1525bbf5c7ddadc16a474c635.zip
cpython-6b60fb9148738de1525bbf5c7ddadc16a474c635.tar.gz
cpython-6b60fb9148738de1525bbf5c7ddadc16a474c635.tar.bz2
#5723: merge with 3.1.
Diffstat (limited to 'Lib/test/json_tests/test_fail.py')
-rw-r--r--Lib/test/json_tests/test_fail.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/Lib/test/json_tests/test_fail.py b/Lib/test/json_tests/test_fail.py
index 9768edf..fcff1d4 100644
--- a/Lib/test/json_tests/test_fail.py
+++ b/Lib/test/json_tests/test_fail.py
@@ -1,6 +1,4 @@
-from unittest import TestCase
-
-import json
+from test.json_tests import PyTest, CTest
# Fri Dec 30 18:57:26 2005
JSONDOCS = [
@@ -61,15 +59,15 @@ SKIPS = {
18: "spec doesn't specify any nesting limitations",
}
-class TestFail(TestCase):
+class TestFail:
def test_failures(self):
for idx, doc in enumerate(JSONDOCS):
idx = idx + 1
if idx in SKIPS:
- json.loads(doc)
+ self.loads(doc)
continue
try:
- json.loads(doc)
+ self.loads(doc)
except ValueError:
pass
else:
@@ -79,7 +77,11 @@ class TestFail(TestCase):
data = {'a' : 1, (1, 2) : 2}
#This is for c encoder
- self.assertRaises(TypeError, json.dumps, data)
+ self.assertRaises(TypeError, self.dumps, data)
#This is for python encoder
- self.assertRaises(TypeError, json.dumps, data, indent=True)
+ self.assertRaises(TypeError, self.dumps, data, indent=True)
+
+
+class TestPyFail(TestFail, PyTest): pass
+class TestCFail(TestFail, CTest): pass