Mark failing tests for test_json

This commit is contained in:
Noah
2020-04-08 12:26:28 -05:00
parent 5e58b05a93
commit 95d12d02ae
5 changed files with 21 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
import os
import json
import doctest
# import doctest
import unittest
from test import support
@@ -9,7 +9,8 @@ from test import support
cjson = support.import_fresh_module('json', fresh=['_json'])
pyjson = support.import_fresh_module('json', blocked=['_json'])
# JSONDecodeError is cached inside the _json module
cjson.JSONDecodeError = cjson.decoder.JSONDecodeError = json.JSONDecodeError
# XXX RustPython TODO: _json module
# cjson.JSONDecodeError = cjson.decoder.JSONDecodeError = json.JSONDecodeError
# create two base classes that will be used by the other tests
class PyTest(unittest.TestCase):
@@ -47,8 +48,8 @@ class TestCTest(CTest):
def load_tests(loader, _, pattern):
suite = unittest.TestSuite()
for mod in (json, json.encoder, json.decoder):
suite.addTest(doctest.DocTestSuite(mod))
# for mod in (json, json.encoder, json.decoder):
# suite.addTest(doctest.DocTestSuite(mod))
suite.addTest(TestPyTest('test_pyjson'))
suite.addTest(TestCTest('test_cjson'))

View File

@@ -1,3 +1,4 @@
import unittest
from test.test_json import PyTest, CTest
# 2007-10-05
@@ -78,6 +79,7 @@ SKIPS = {
}
class TestFail:
@unittest.skip("TODO: RUSTPYTHON")
def test_failures(self):
for idx, doc in enumerate(JSONDOCS):
idx = idx + 1
@@ -103,6 +105,7 @@ class TestFail:
'Object of type module is not JSON serializable'):
self.dumps(sys)
@unittest.skip("TODO: RUSTPYTHON")
def test_truncated_input(self):
test_cases = [
('', 'Expecting value', 0),

View File

@@ -1,3 +1,4 @@
import unittest
import sys
from test.test_json import PyTest, CTest
@@ -85,6 +86,7 @@ class TestScanstring:
scanstring('["Bad value", truth]', 2, True),
('Bad value', 12))
@unittest.skip("TODO: RUSTPYTHON")
def test_surrogates(self):
scanstring = self.json.decoder.scanstring
def assertScan(given, expect):
@@ -101,6 +103,7 @@ class TestScanstring:
assertScan('"z\ud834\\udd20x"', 'z\ud834\udd20x')
assertScan('"z\ud834x"', 'z\ud834x')
@unittest.skip("TODO: RUSTPYTHON")
def test_bad_escapes(self):
scanstring = self.json.decoder.scanstring
bad_escapes = [
@@ -132,6 +135,7 @@ class TestScanstring:
with self.assertRaises(self.JSONDecodeError, msg=s):
scanstring(s, 1, True)
@unittest.skip("TODO: RUSTPYTHON")
def test_overflow(self):
with self.assertRaises(OverflowError):
self.json.decoder.scanstring(b"xxx", sys.maxsize+1)

View File

@@ -7,6 +7,7 @@ from test import support
from test.support.script_helper import assert_python_ok
@unittest.skip("TODO: RUSTPYTHON") # Need to fix subprocess to take env
class TestTool(unittest.TestCase):
data = """

View File

@@ -1,3 +1,4 @@
import unittest
import codecs
from collections import OrderedDict
from test.test_json import PyTest, CTest
@@ -7,21 +8,25 @@ class TestUnicode:
# test_encoding1 and test_encoding2 from 2.x are irrelevant (only str
# is supported as input, not bytes).
@unittest.skip("TODO: RUSTPYTHON")
def test_encoding3(self):
u = '\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'
j = self.dumps(u)
self.assertEqual(j, '"\\u03b1\\u03a9"')
@unittest.skip("TODO: RUSTPYTHON")
def test_encoding4(self):
u = '\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'
j = self.dumps([u])
self.assertEqual(j, '["\\u03b1\\u03a9"]')
@unittest.skip("TODO: RUSTPYTHON")
def test_encoding5(self):
u = '\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'
j = self.dumps(u, ensure_ascii=False)
self.assertEqual(j, '"{0}"'.format(u))
@unittest.skip("TODO: RUSTPYTHON")
def test_encoding6(self):
u = '\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'
j = self.dumps([u], ensure_ascii=False)
@@ -37,6 +42,8 @@ class TestUnicode:
self.assertEqual(self.loads('"' + u + '"'), u)
self.assertEqual(self.loads('"z\\ud834\\udd20x"'), u)
# just takes FOREVER (3min+), unskip when it doesn't
@unittest.skip("TODO: RUSTPYTHON time")
def test_unicode_decode(self):
for i in range(0, 0xd7ff):
u = chr(i)
@@ -52,6 +59,7 @@ class TestUnicode:
self.assertRaises(TypeError, self.dumps, b"hi")
self.assertRaises(TypeError, self.dumps, [b"hi"])
@unittest.skip("TODO: RUSTPYTHON")
def test_bytes_decode(self):
for encoding, bom in [
('utf-8', codecs.BOM_UTF8),