Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

Port CPython 3.6.5 test cases #8

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add RustTest to CPython json test cases
  • Loading branch information
wdv4758h committed Jun 3, 2018
commit 5f4a9ac495f3d1893c8e5d2db1881ba2ba2734ee
2 changes: 1 addition & 1 deletion tests/cpython/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import unittest
from test.test_json import load_tests
from cpython import load_tests

unittest.main()
3 changes: 2 additions & 1 deletion tests/cpython/test_decode.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import decimal
from io import StringIO, BytesIO
from collections import OrderedDict
from test.test_json import PyTest, CTest
from cpython import PyTest, CTest, RustTest


class _TestDecode:
Expand Down Expand Up @@ -95,3 +95,4 @@ def test_negative_index(self):

class TestPyDecode(_TestDecode, PyTest): pass
class TestCDecode(_TestDecode, CTest): pass
class TestRustDecode(_TestDecode, RustTest): pass
3 changes: 2 additions & 1 deletion tests/cpython/test_default.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from test.test_json import PyTest, CTest
from cpython import PyTest, CTest, RustTest


class _TestDefault:
Expand All @@ -10,3 +10,4 @@ def test_default(self):

class TestPyDefault(_TestDefault, PyTest): pass
class TestCDefault(_TestDefault, CTest): pass
class TestRustDefault(_TestDefault, RustTest): pass
4 changes: 3 additions & 1 deletion tests/cpython/test_dump.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from io import StringIO
from test.test_json import PyTest, CTest
from cpython import PyTest, CTest, RustTest

from test.support import bigmemtest, _1G

Expand Down Expand Up @@ -66,3 +66,5 @@ def test_large_list(self, size):
self.assertEqual(encoded[:1], "[")
self.assertEqual(encoded[-2:], "1]")
self.assertEqual(encoded[1:-2], "1, " * (N - 1))

class TestRustDump(_TestDump, RustTest): pass
4 changes: 3 additions & 1 deletion tests/cpython/test_encode_basestring_ascii.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections import OrderedDict
from test.test_json import PyTest, CTest
from cpython import PyTest, CTest, RustTest
from test.support import bigaddrspacetest


Expand Down Expand Up @@ -46,3 +46,5 @@ def test_overflow(self):
s = "\x00"*size
with self.assertRaises(OverflowError):
self.json.encoder.encode_basestring_ascii(s)

class TestRustEncodeBasestringAscii(_TestEncodeBasestringAscii, RustTest): pass
3 changes: 2 additions & 1 deletion tests/cpython/test_enum.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from enum import Enum, IntEnum
from math import isnan
from test.test_json import PyTest, CTest
from cpython import PyTest, CTest, RustTest

SMALL = 1
BIG = 1<<32
Expand Down Expand Up @@ -118,3 +118,4 @@ def test_dict_values(self):

class TestPyEnum(_TestEnum, PyTest): pass
class TestCEnum(_TestEnum, CTest): pass
class TestRustEnum(_TestEnum, RustTest): pass
3 changes: 2 additions & 1 deletion tests/cpython/test_fail.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from test.test_json import PyTest, CTest
from cpython import PyTest, CTest, RustTest

# 2007-10-05
JSONDOCS = [
Expand Down Expand Up @@ -214,3 +214,4 @@ def test_linecol(self):

class TestPyFail(_TestFail, PyTest): pass
class TestCFail(_TestFail, CTest): pass
class TestRustFail(_TestFail, RustTest): pass
3 changes: 2 additions & 1 deletion tests/cpython/test_float.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import math
from test.test_json import PyTest, CTest
from cpython import PyTest, CTest, RustTest


class _TestFloat:
Expand Down Expand Up @@ -31,3 +31,4 @@ def test_allow_nan(self):

class TestPyFloat(_TestFloat, PyTest): pass
class TestCFloat(_TestFloat, CTest): pass
class TestRustFloat(_TestFloat, RustTest): pass
3 changes: 2 additions & 1 deletion tests/cpython/test_indent.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import textwrap
from io import StringIO
from test.test_json import PyTest, CTest
from cpython import PyTest, CTest, RustTest


class _TestIndent:
Expand Down Expand Up @@ -65,3 +65,4 @@ def check(indent, expected):

class TestPyIndent(_TestIndent, PyTest): pass
class TestCIndent(_TestIndent, CTest): pass
class TestRustIndent(_TestIndent, RustTest): pass
3 changes: 2 additions & 1 deletion tests/cpython/test_pass1.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from test.test_json import PyTest, CTest
from cpython import PyTest, CTest, RustTest


# from http://json.org/JSON_checker/test/pass1.json
Expand Down Expand Up @@ -73,3 +73,4 @@ def test_parse(self):

class TestPyPass1(_TestPass1, PyTest): pass
class TestCPass1(_TestPass1, CTest): pass
class TestRustPass1(_TestPass1, RustTest): pass
3 changes: 2 additions & 1 deletion tests/cpython/test_pass2.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from test.test_json import PyTest, CTest
from cpython import PyTest, CTest, RustTest


# from http://json.org/JSON_checker/test/pass2.json
Expand All @@ -16,3 +16,4 @@ def test_parse(self):

class TestPyPass2(_TestPass2, PyTest): pass
class TestCPass2(_TestPass2, CTest): pass
class TestRustPass2(_TestPass2, RustTest): pass
3 changes: 2 additions & 1 deletion tests/cpython/test_pass3.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from test.test_json import PyTest, CTest
from cpython import PyTest, CTest, RustTest


# from http://json.org/JSON_checker/test/pass3.json
Expand All @@ -22,3 +22,4 @@ def test_parse(self):

class TestPyPass3(_TestPass3, PyTest): pass
class TestCPass3(_TestPass3, CTest): pass
class TestRustPass3(_TestPass3, RustTest): pass
3 changes: 2 additions & 1 deletion tests/cpython/test_recursion.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from test.test_json import PyTest, CTest
from cpython import PyTest, CTest, RustTest


class JSONTestObject:
Expand Down Expand Up @@ -98,3 +98,4 @@ def default(self, o):

class TestPyRecursion(_TestRecursion, PyTest): pass
class TestCRecursion(_TestRecursion, CTest): pass
class TestRustRecursion(_TestRecursion, RustTest): pass
3 changes: 2 additions & 1 deletion tests/cpython/test_scanstring.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sys
from test.test_json import PyTest, CTest
from cpython import PyTest, CTest, RustTest


class _TestScanstring:
Expand Down Expand Up @@ -139,3 +139,4 @@ def test_overflow(self):

class TestPyScanstring(_TestScanstring, PyTest): pass
class TestCScanstring(_TestScanstring, CTest): pass
class TestRustScanstring(_TestScanstring, RustTest): pass
3 changes: 2 additions & 1 deletion tests/cpython/test_separators.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import textwrap
from test.test_json import PyTest, CTest
from cpython import PyTest, CTest, RustTest


class _TestSeparators:
Expand Down Expand Up @@ -48,3 +48,4 @@ def test_illegal_separators(self):

class TestPySeparators(_TestSeparators, PyTest): pass
class TestCSeparators(_TestSeparators, CTest): pass
class TestRustSeparators(_TestSeparators, RustTest): pass
2 changes: 1 addition & 1 deletion tests/cpython/test_speedups.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from test.test_json import CTest
from cpython import CTest


class BadBool:
Expand Down
3 changes: 2 additions & 1 deletion tests/cpython/test_unicode.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import codecs
from collections import OrderedDict
from test.test_json import PyTest, CTest
from cpython import PyTest, CTest, RustTest


class _TestUnicode:
Expand Down Expand Up @@ -96,3 +96,4 @@ def test_object_pairs_hook_with_unicode(self):

class TestPyUnicode(_TestUnicode, PyTest): pass
class TestCUnicode(_TestUnicode, CTest): pass
class TestRustUnicode(_TestUnicode, RustTest): pass