Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions .cspell.dict/rustpython.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
cfgs
cfunction
miri
py
pyarg
Expand Down
5 changes: 4 additions & 1 deletion Lib/_pydatetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -2325,7 +2325,10 @@ def __sub__(self, other):
if myoff == otoff:
return base
if myoff is None or otoff is None:
raise TypeError("cannot mix naive and timezone-aware time")
# RUSTPYTHON: _pydatetime is the only implementation here, so use
# the message CPython's C _datetime raises rather than this one's.
raise TypeError(
"can't subtract offset-naive and offset-aware datetimes")
return base + otoff - myoff

def __hash__(self):
Expand Down
2 changes: 0 additions & 2 deletions Lib/test/string_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1301,7 +1301,6 @@ def test___contains__(self):
self.checkequal(False, 'asd', '__contains__', 'asdf')
self.checkequal(False, '', '__contains__', 'asdf')

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_subscript(self):
self.checkequal('a', 'abc', '__getitem__', 0)
self.checkequal('c', 'abc', '__getitem__', -1)
Expand Down Expand Up @@ -1556,7 +1555,6 @@ def test_none_arguments(self):
self.checkequal(True, s, 'startswith', 'h', None, -2)
self.checkequal(False, s, 'startswith', 'x', None, None)

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_find_etc_raise_correct_error_messages(self):
# issue 11828
s = 'hello'
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_ast/test_ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,7 @@ def test_replace_reject_unknown_instance_fields(self):
self.assertIs(node.ctx, context)
self.assertRaises(AttributeError, getattr, node, 'unknown')

@unittest.expectedFailure # TODO: RUSTPYTHON; Wrong error message
@unittest.expectedFailure # TODO: RUSTPYTHON; needs non-string keyword keys to reach the callee instead of being rejected by the call itself
def test_replace_non_str_kwarg(self):
node = ast.Name(id="x")
errmsg = "got an unexpected keyword argument <object object"
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_asyncgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -1835,7 +1835,6 @@ async def run():
res = self.loop.run_until_complete(run())
self.assertEqual(res, [i * 2 for i in range(1, 10)])

@unittest.expectedFailure # TODO: RUSTPYTHON; AttributeError: __aiter__
def test_async_gen_expression_incorrect(self):
async def ag():
yield 42
Expand Down
2 changes: 0 additions & 2 deletions Lib/test/test_builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -988,8 +988,6 @@ def test_eval_builtins_mapping(self):
ns = {'__builtins__': types.MappingProxyType({})}
self.assertRaisesRegex(NameError, "name 'superglobal' is not defined",
eval, code, ns)

@unittest.expectedFailure # TODO: RUSTPYTHON; wrong error message
def test_exec_builtins_mapping_import(self):
code = compile("import foo.bar", "test", "exec")
ns = {'__builtins__': types.MappingProxyType({})}
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_bytes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,6 @@ def test_integer_arguments_out_of_byte_range(self):
self.assertRaises(ValueError, method, 256)
self.assertRaises(ValueError, method, 9999)

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_find_etc_raise_correct_error_messages(self):
# issue 11828
b = self.type2test(b'hello')
Expand Down
2 changes: 0 additions & 2 deletions Lib/test/test_bz2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1031,8 +1031,6 @@ def test_failure(self):
self.assertRaises(Exception, bzd.decompress, self.BAD_DATA * 30)
# Previously, a second call could crash due to internal inconsistency
self.assertRaises(Exception, bzd.decompress, self.BAD_DATA * 30)

@unittest.expectedFailure # TODO: RUSTPYTHON; Wrong error message
def test_decompress_after_data_error(self):
data = bytes.fromhex(
"425a6839314159265359000000000000007fffff000000000000000000000000"
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,6 @@ class A:
with self.assertRaisesRegex(AttributeError, error_msg):
del A.x

@unittest.expectedFailure # TODO: RUSTPYTHON
def testObjectAttributeAccessErrorMessages(self):
class A:
pass
Expand Down
4 changes: 0 additions & 4 deletions Lib/test/test_coroutines.py
Original file line number Diff line number Diff line change
Expand Up @@ -1604,7 +1604,6 @@ async def test3():
self.assertEqual(buffer, [i for i in range(1, 21)] +
['what?', 'end'])

@unittest.expectedFailure # TODO: RUSTPYTHON; AttributeError: __aiter__
def test_for_2(self):
tup = (1, 2, 3)
refs_before = sys.getrefcount(tup)
Expand All @@ -1620,7 +1619,6 @@ async def foo():

self.assertEqual(sys.getrefcount(tup), refs_before)

@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: "that does not implement __anext__" does not match "'async for' requires an iterator with __anext__ method, got I"
def test_for_3(self):
class I:
def __aiter__(self):
Expand All @@ -1641,7 +1639,6 @@ async def foo():

self.assertEqual(sys.getrefcount(aiter), refs_before)

@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: "async for' received an invalid object.*__anext__.*tuple" does not match "'tuple' object is not an iterator"
def test_for_4(self):
class I:
def __aiter__(self):
Expand Down Expand Up @@ -1789,7 +1786,6 @@ async def foo():
run_async(foo())
self.assertEqual(CNT, 0)

@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: "an invalid object from __anext__" does not match "'F' object is not an iterator"
def test_for_11(self):
class F:
def __aiter__(self):
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_descr.py
Original file line number Diff line number Diff line change
Expand Up @@ -4074,7 +4074,6 @@ def test_ipow_exception_text(self):
y = x ** 2
self.assertIn('unsupported operand type(s) for **', str(cm.exception))

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_pow_wrapper_error_messages(self):
self.assertRaisesRegex(TypeError,
'expected 1 or 2 arguments, got 0',
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_descrtut.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def merge(self, other):
>>> a.default = -1
>>> a[1]
-1
>>> a.x1 = 1 # TODO: RUSTPYTHON; # doctest: +EXPECTED_FAILURE
>>> a.x1 = 1
Traceback (most recent call last):
File "<stdin>", line 1, in ?
AttributeError: 'defaultdict2' object has no attribute 'x1' and no __dict__ for setting new attributes
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -1593,7 +1593,6 @@ class Shenanigans:
self.assertEqual(holds_reference.ref['data'], 42)
self.assertEqual(holds_reference.attr, "whatever")

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_unhashable_key(self):
d = {'a': 1}
key = [1, 2, 3]
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -3036,7 +3036,6 @@ class ThirdFailedStrEnum(StrEnum):
one = '1'
two = b'2', 'ascii', 9

@unittest.expectedFailure # TODO: RUSTPYTHON; fails on encoding testing : TypeError: Expected type 'str' but 'builtin_function_or_method' found
def test_custom_strenum(self):
class CustomStrEnum(str, Enum):
pass
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1724,7 +1724,6 @@ def test_errno_ENOTDIR(self):
os.listdir(__file__)
self.assertEqual(cm.exception.errno, errno.ENOTDIR, cm.exception)

@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: None != 'Exception ignored while calling dealloca[83 chars]200>'
def test_unraisable(self):
# Issue #22836: PyErr_WriteUnraisable() should give sensible reports
class BrokenDel:
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_extcall.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@
... False
True

>>> id(1, **{'foo': 1}) # TODO: RUSTPYTHON # doctest:+EXPECTED_FAILURE
>>> id(1, **{'foo': 1})
Traceback (most recent call last):
...
TypeError: id() takes no keyword arguments
Expand Down
3 changes: 0 additions & 3 deletions Lib/test/test_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,6 @@ def test_with_an_underscore_and_a_comma_in_format_specifier(self):
with self.assertRaisesRegex(ValueError, error_msg):
'{:._,f}'.format(1.1)

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_better_error_message_format(self):
# https://bugs.python.org/issue20524
for value in [12j, 12, 12.0, "12"]:
Expand All @@ -551,7 +550,6 @@ def test_better_error_message_format(self):
with self.assertRaisesRegex(ValueError, err):
eval("f'xx{value:{bad_format_spec}}yy'")

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_unicode_in_error_message(self):
str_err = re.escape(
"Invalid format specifier '%ЫйЯЧ' for object of type 'str'")
Expand Down Expand Up @@ -615,7 +613,6 @@ def test_negative_zero(self):
self.assertEqual(f"{-0.:x>z6.1f}", "xxx0.0")
self.assertEqual(f"{-0.:🖤>z6.1f}", "🖤🖤🖤0.0") # multi-byte fill char

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_specifier_z_error(self):
error_msg = re.compile("Invalid format specifier '.*z.*'")
with self.assertRaisesRegex(ValueError, error_msg):
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_fstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -1288,7 +1288,6 @@ def test_nested_fstrings(self):
self.assertEqual(f'{f"{0}"*3}', '000')
self.assertEqual(f'{f"{y}"*3}', '555')

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_invalid_string_prefixes(self):
single_quote_cases = ["fu''",
"uf''",
Expand Down
4 changes: 2 additions & 2 deletions Lib/test/test_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -2729,7 +2729,7 @@ def printsolution(self, x):

Our ill-behaved code should be invoked during GC:

>>> with support.catch_unraisable_exception() as cm: # TODO: RUSTPYTHON # doctest: +EXPECTED_FAILURE
>>> with support.catch_unraisable_exception() as cm:
... g = f()
... next(g)
... gen_repr = repr(g)
Expand Down Expand Up @@ -2847,7 +2847,7 @@ def printsolution(self, x):
... raise RuntimeError(message)
... invoke("del failed")
...
>>> with support.catch_unraisable_exception() as cm: # TODO: RUSTPYTHON # doctest: +EXPECTED_FAILURE
>>> with support.catch_unraisable_exception() as cm:
... leaker = Leaker()
... del_repr = repr(type(leaker).__del__)
... del leaker
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_hashlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ def test_clinic_signature(self):
self._hashlib.new(digest_name, data=b'')
self._hashlib.new(digest_name, string=b'')

@unittest.expectedFailure # TODO: RUSTPYTHON; duplicate positional/keyword arg error message differs
@unittest.skipIf(get_fips_mode(), "skip in FIPS mode")
def test_clinic_signature_errors(self):
nomsg = b''
Expand Down
12 changes: 10 additions & 2 deletions Lib/test/test_json/test_scanstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,19 @@ def test_bad_escapes(self):
with self.assertRaises(self.JSONDecodeError, msg=s):
scanstring(s, 1, True)

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_overflow(self):
with self.assertRaises(OverflowError):
self.json.decoder.scanstring("xxx", sys.maxsize+1)


class TestPyScanstring(TestScanstring, PyTest): pass
class TestPyScanstring(TestScanstring, PyTest):
# TODO: RUSTPYTHON; the pure-Python scanner reports Unterminated string
# instead of OverflowError for out-of-range indices
@unittest.expectedFailure
def test_overflow(self):
with self.assertRaises(OverflowError):
self.json.decoder.scanstring("xxx", sys.maxsize+1)


class TestCScanstring(TestScanstring, CTest): pass
class TestCScanstring(TestScanstring, CTest): pass
2 changes: 0 additions & 2 deletions Lib/test/test_lzma.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ def test_simple_bad_args(self):
lzd.decompress(empty)
self.assertRaises(EOFError, lzd.decompress, b"quux")

@unittest.expectedFailure # TODO: RUSTPYTHON; lzma.LZMAError: Failed to initialize encoder
def test_bad_filter_spec(self):
self.assertRaises(TypeError, LZMACompressor, filters=[b"wobsite"])
self.assertRaises(ValueError, LZMACompressor, filters=[{"xyzzy": 3}])
Expand Down Expand Up @@ -675,7 +674,6 @@ def test_init_bad_preset(self):
with self.assertRaises(ValueError):
LZMAFile(BytesIO(COMPRESSED_XZ), preset=3)

@unittest.expectedFailure # TODO: RUSTPYTHON; lzma.LZMAError: Failed to initialize encoder
def test_init_bad_filter_spec(self):
with self.assertRaises(TypeError):
LZMAFile(BytesIO(), "w", filters=[b"wobsite"])
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_marshal.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,6 @@ def test_loads_reject_unicode_strings(self):
unicode_string = 'T'
self.assertRaises(TypeError, marshal.loads, unicode_string)

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_bad_reader(self):
class BadReader(io.BytesIO):
def readinto(self, buf):
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_mmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,6 @@ def __index__(self):
self.assertEqual(m.madvise(mmap.MADV_NORMAL, 0, Number()), None)
self.assertEqual(m.madvise(mmap.MADV_NORMAL, 0, size), None)

@unittest.expectedFailureIf(sys.platform in ("linux", "win32"), "TODO: RUSTPYTHON")
def test_resize_up_anonymous_mapping(self):
"""If the mmap is backed by the pagefile ensure a resize up can happen
and that the original data is still in place
Expand Down
6 changes: 3 additions & 3 deletions Lib/test/test_pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1960,12 +1960,12 @@ def test_pdb_run_with_incorrect_argument():
"""Testing run and runeval with incorrect first argument.

>>> pti = PdbTestInput(['continue',])
>>> with pti: # TODO: RUSTPYTHON # doctest: +EXPECTED_FAILURE
>>> with pti:
... pdb_invoke('run', lambda x: x)
Traceback (most recent call last):
TypeError: exec() arg 1 must be a string, bytes or code object

>>> with pti: # TODO: RUSTPYTHON # doctest: +EXPECTED_FAILURE
>>> with pti:
... pdb_invoke('runeval', lambda x: x)
Traceback (most recent call last):
TypeError: eval() arg 1 must be a string, bytes or code object
Expand Down Expand Up @@ -2806,7 +2806,7 @@ def test_pdb_closure():
... g = 3
... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()

>>> with PdbTestInput([ # TODO: RUSTPYTHON # doctest: +NORMALIZE_WHITESPACE +EXPECTED_FAILURE
>>> with PdbTestInput([ # doctest: +NORMALIZE_WHITESPACE
... 'k',
... 'g',
... 'y = y',
Expand Down
2 changes: 0 additions & 2 deletions Lib/test/test_plistlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1137,8 +1137,6 @@ def test_dump_aware_datetime_without_aware_datetime_option(self):
msg = "can't subtract offset-naive and offset-aware datetimes"
with self.assertRaisesRegex(TypeError, msg):
plistlib.dumps(dt, fmt=plistlib.FMT_BINARY, aware_datetime=False)

@unittest.expectedFailure # TODO: RUSTPYTHON; Wrong error message
def test_dump_utc_aware_datetime_without_aware_datetime_option(self):
dt = datetime.datetime(2345, 6, 7, 8, tzinfo=datetime.UTC)
msg = "can't subtract offset-naive and offset-aware datetimes"
Expand Down
3 changes: 0 additions & 3 deletions Lib/test/test_posix.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,6 @@ def test_fstat(self):
finally:
fp.close()

@unittest.expectedFailure # TODO: RUSTPYTHON
@unittest.skipUnless(hasattr(posix, 'stat'),
'test needs posix.stat()')
@unittest.skipUnless(os.stat in os.supports_follow_symlinks,
Expand Down Expand Up @@ -2043,8 +2042,6 @@ def test_scheduler_allow_none(self):
path, args = self.NOOP_PROGRAM[0], self.NOOP_PROGRAM
pid = self.spawn_func(path, args, os.environ, scheduler=None)
support.wait_process(pid, exitcode=0)

@unittest.expectedFailure # TODO: RUSTPYTHON; Wrong error message
@support.subTests("scheduler", [object(), 1, [1, 2]])
def test_scheduler_wrong_type(self, scheduler):
path, args = self.NOOP_PROGRAM[0], self.NOOP_PROGRAM
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ def test_range(self):
r = range(-sys.maxsize, sys.maxsize, 2)
self.assertEqual(len(r), sys.maxsize)

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_range_constructor_error_messages(self):
with self.assertRaisesRegex(
TypeError,
Expand Down
2 changes: 0 additions & 2 deletions Lib/test/test_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -983,8 +983,6 @@ def testSocketError(self):
raise socket.herror
with self.assertRaises(OSError, msg=msg % 'socket.gaierror'):
raise socket.gaierror

@unittest.expectedFailure # TODO: RUSTPYTHON; error message format differs
def testSendtoErrors(self):
# Testing that sendto doesn't mask failures. See #10169.
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_sqlite3/test_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ def progress(status, remaining, total):
self.assertEqual(len(journal), 1)
self.assertEqual(journal[0], 0)

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_non_callable_progress(self):
with self.assertRaises(TypeError) as cm:
with memory_database() as bck:
Expand Down
2 changes: 0 additions & 2 deletions Lib/test/test_sqlite3/test_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,11 @@ def test_sqlite_row_index(self):
with self.assertRaises(IndexError):
row[complex()] # index must be int or string

@unittest.expectedFailure # TODO: RUSTPYTHON; TypeError: can't delete attribute
def test_delete_connection_row_factory(self):
# gh-149738: deleting row_factory should raise an exception
with self.assertRaises(AttributeError):
del self.con.row_factory

@unittest.expectedFailure # TODO: RUSTPYTHON; TypeError: can't delete attribute
def test_delete_connection_text_factory(self):
# gh-149738: deleting text_factory should raise an exception
with self.assertRaises(AttributeError):
Expand Down
Loading
Loading