Skip to content
Merged
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
3 changes: 1 addition & 2 deletions Lib/test/test_grammar.py
Original file line number Diff line number Diff line change
Expand Up @@ -1723,8 +1723,7 @@ class G: pass
class H: pass
@d := class_decorator
class I: pass
# TODO: RUSTPYTHON; SyntaxError: the symbol 'class_decorator' must be present in the symbol table
# @lambda c: class_decorator(c)
@lambda c: class_decorator(c)
class J: pass
@[..., class_decorator, ...][1]
class K: pass
Expand Down
4 changes: 1 addition & 3 deletions Lib/test/test_listcomps.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,9 @@ class i: [__classdict__ for x in y]
"""
self._check_in_scopes(code, raises=NameError)

@unittest.expectedFailure # TODO: RUSTPYTHON; SyntaxError: compiler_make_closure: cannot find '__classdict__' in parent vars
def test_references___classdict___nested(self):
class _C:
# res = [(lambda: __classdict__)() for _ in [1]] # TODO: RUSTPYTHON
pass # TODO: RUSTPYTHON
res = [(lambda: __classdict__)() for _ in [1]]
self.assertIn("res", _C.res[0])

def test_references___conditional_annotations__(self):
Expand Down
26 changes: 17 additions & 9 deletions Lib/test/test_patma.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import inspect
import sys
import unittest
from test import support


@dataclasses.dataclass
Expand Down Expand Up @@ -2563,15 +2564,14 @@ def test_patma_240(self):
self.assertEqual(y, 0)
self.assertEqual(z, {0: 1})

# TODO: RUSTPYTHON
# def test_patma_241(self):
# x = [[{0: 0}]]
# match x:
# case list([({-0-0j: int(real=0+0j, imag=0-0j) | (1) as z},)]):
# y = 0
# self.assertEqual(x, [[{0: 0}]])
# self.assertEqual(y, 0)
# self.assertEqual(z, 0)
def test_patma_241(self):
x = [[{0: 0}]]
match x:
case list([({-0-0j: int(real=0+0j, imag=0-0j) | (1) as z},)]):
y = 0
self.assertEqual(x, [[{0: 0}]])
self.assertEqual(y, 0)
self.assertEqual(z, 0)

def test_patma_242(self):
x = range(3)
Expand Down Expand Up @@ -3016,6 +3016,13 @@ def test_multiple_assignments_to_name_in_pattern_5(self):
pass
""")

def test_multiple_assignments_to_name_in_pattern_6(self):
self.assert_syntax_error("""
match ...:
case a as a + 1: # NAME and expression with no ()
pass
""")

def test_multiple_starred_names_in_sequence_pattern_0(self):
self.assert_syntax_error("""
match ...:
Expand Down Expand Up @@ -3492,6 +3499,7 @@ def f(command): # 0
self.assertListEqual(self._trace(f, 1), [1, 2, 3])
self.assertListEqual(self._trace(f, 0), [1, 2, 5, 6])

@support.skip_wasi_stack_overflow()
def test_parser_deeply_nested_patterns(self):
# Deeply nested patterns can cause exponential backtracking when parsing.
# See gh-93671 for more information.
Expand Down
3 changes: 1 addition & 2 deletions Lib/test/test_pep646_syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,7 @@
__test__ = {'doctests' : doctests}

def load_tests(loader, tests, pattern):
from test.support.rustpython import DocTestChecker # TODO: RUSTPYTHON
tests.addTest(doctest.DocTestSuite(checker=DocTestChecker())) # TODO: RUSTPYTHON
tests.addTest(doctest.DocTestSuite())
return tests


Expand Down
4 changes: 2 additions & 2 deletions Lib/test/test_super.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,15 @@ def f():
__class__""", globals(), {})
self.assertIs(type(e.exception), NameError) # Not UnboundLocalError
class X:
# global __class__ # TODO: RUSTPYTHON; SyntaxError: name '__class__' is assigned to before global declaration
global __class__
__class__ = 42
def f():
__class__
self.assertEqual(globals()["__class__"], 42)
del globals()["__class__"]
self.assertNotIn("__class__", X.__dict__)
class X:
# nonlocal __class__ # TODO: RUSTPYTHON; SyntaxError: name '__class__' is assigned to before nonlocal declaration
nonlocal __class__
__class__ = 42
def f():
__class__
Expand Down
Loading