Skip to content
Merged
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
Mark failing tests
  • Loading branch information
ShaharNaveh committed Jul 20, 2025
commit 8e3f42a3a4346dae7f4223dc1f9f600af8eda029
6 changes: 5 additions & 1 deletion Lib/test/test_json/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@


# import json with and without accelerations
cjson = import_helper.import_fresh_module('json', fresh=['_json'])
# XXX RUSTPYTHON: we don't import _json as fresh since the fresh module isn't placed
# into the sys.modules cache, and therefore the vm can't recognize the _json.Scanner class
cjson = import_helper.import_fresh_module('json') #, fresh=['_json'])
pyjson = import_helper.import_fresh_module('json', blocked=['_json'])
# JSONDecodeError is cached inside the _json module
cjson.JSONDecodeError = cjson.decoder.JSONDecodeError = json.JSONDecodeError
Expand Down Expand Up @@ -39,6 +41,8 @@ def test_pyjson(self):
'json.encoder')

class TestCTest(CTest):
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_cjson(self):
self.assertEqual(self.json.scanner.make_scanner.__module__, '_json')
self.assertEqual(self.json.decoder.scanstring.__module__, '_json')
Expand Down
13 changes: 12 additions & 1 deletion Lib/test/test_json/test_decode.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from test.test_json import PyTest, CTest
from test import support

import unittest # XXX: RUSTPYTHON; importing to be able to skip tests


class TestDecode:
def test_decimal(self):
Expand All @@ -16,6 +18,8 @@ def test_float(self):
self.assertIsInstance(rval, float)
self.assertEqual(rval, 1.0)

# TODO: RUSTPYTHON
@unittest.skip("TODO: RUSTPYTHON; called `Result::unwrap()` on an `Err` value: ParseFloatError { kind: Invalid }")
def test_nonascii_digits_rejected(self):
# JSON specifies only ascii digits, see gh-125687
for num in ["1\uff10", "0.\uff10", "0e\uff10"]:
Expand Down Expand Up @@ -123,6 +127,8 @@ def test_negative_index(self):
d = self.json.JSONDecoder()
self.assertRaises(ValueError, d.raw_decode, 'a'*42, -50000)

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_limit_int(self):
maxdigits = 5000
with support.adjust_int_max_str_digits(maxdigits):
Expand All @@ -132,4 +138,9 @@ def test_limit_int(self):


class TestPyDecode(TestDecode, PyTest): pass
class TestCDecode(TestDecode, CTest): pass

class TestCDecode(TestDecode, CTest):
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_keys_reuse(self):
return super().test_keys_reuse()
9 changes: 8 additions & 1 deletion Lib/test/test_json/test_fail.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from test.test_json import PyTest, CTest

import unittest # XXX: RUSTPYTHON; importing to be able to skip tests

# 2007-10-05
JSONDOCS = [
# https://json.org/JSON_checker/test/fail1.json
Expand Down Expand Up @@ -218,4 +220,9 @@ def test_linecol(self):
(line, col, idx))

class TestPyFail(TestFail, PyTest): pass
class TestCFail(TestFail, CTest): pass

class TestCFail(TestFail, CTest):
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_failures(self):
return super().test_failures()
3 changes: 3 additions & 0 deletions Lib/test/test_json/test_scanstring.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import sys
from test.test_json import PyTest, CTest

import unittest # XXX: RUSTPYTHON; importing to be able to skip tests

class TestScanstring:
def test_scanstring(self):
Expand Down Expand Up @@ -142,6 +143,8 @@ def test_bad_escapes(self):
with self.assertRaises(self.JSONDecodeError, msg=s):
scanstring(s, 1, True)

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_overflow(self):
with self.assertRaises(OverflowError):
self.json.decoder.scanstring(b"xxx", sys.maxsize+1)
Expand Down
8 changes: 8 additions & 0 deletions Lib/test/test_json/test_speedups.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from test.test_json import CTest

import unittest # XXX: RUSTPYTHON; importing to be able to skip tests


class BadBool:
def __bool__(self):
Expand Down Expand Up @@ -38,6 +40,8 @@ def test_make_encoder(self):
b"\xCD\x7D\x3D\x4E\x12\x4C\xF9\x79\xD7\x52\xBA\x82\xF2\x27\x4A\x7D\xA0\xCA\x75",
None)

# TODO: RUSTPYTHON; TypeError: 'NoneType' object is not callable
@unittest.expectedFailure
def test_bad_str_encoder(self):
# Issue #31505: There shouldn't be an assertion failure in case
# c_make_encoder() receives a bad encoder() argument.
Expand All @@ -59,6 +63,8 @@ def bad_encoder2(*args):
with self.assertRaises(ZeroDivisionError):
enc('spam', 4)

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_bad_markers_argument_to_encoder(self):
# https://bugs.python.org/issue45269
with self.assertRaisesRegex(
Expand All @@ -68,6 +74,8 @@ def test_bad_markers_argument_to_encoder(self):
self.json.encoder.c_make_encoder(1, None, None, None, ': ', ', ',
False, False, False)

# TODO: RUSTPYTHON; ZeroDivisionError not raised by test
@unittest.expectedFailure
def test_bad_bool_args(self):
def test(name):
self.json.encoder.JSONEncoder(**{name: BadBool()}).encode({'a': 1})
Expand Down
4 changes: 4 additions & 0 deletions Lib/test/test_json/test_unicode.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from collections import OrderedDict
from test.test_json import PyTest, CTest

import unittest # XXX: RUSTPYTHON; importing to be able to skip tests


class TestUnicode:
# test_encoding1 and test_encoding2 from 2.x are irrelevant (only str
Expand Down Expand Up @@ -57,6 +59,8 @@ def test_bytes_encode(self):
self.assertRaises(TypeError, self.dumps, b"hi")
self.assertRaises(TypeError, self.dumps, [b"hi"])

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_bytes_decode(self):
for encoding, bom in [
('utf-8', codecs.BOM_UTF8),
Expand Down
Loading