Skip to content

Commit ba23db2

Browse files
authored
Uncomment codegen crashing tests (#8175)
* Update `test_patma.py` to 3.14.6 * Update `test_listcomps.py` * Align patches of `test_super.py` * Align `test_grammar.py` * Align patches for `test_pep646_syntax.py`
1 parent 33b8c10 commit ba23db2

5 files changed

Lines changed: 22 additions & 18 deletions

File tree

Lib/test/test_grammar.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1723,8 +1723,7 @@ class G: pass
17231723
class H: pass
17241724
@d := class_decorator
17251725
class I: pass
1726-
# TODO: RUSTPYTHON; SyntaxError: the symbol 'class_decorator' must be present in the symbol table
1727-
# @lambda c: class_decorator(c)
1726+
@lambda c: class_decorator(c)
17281727
class J: pass
17291728
@[..., class_decorator, ...][1]
17301729
class K: pass

Lib/test/test_listcomps.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,9 @@ class i: [__classdict__ for x in y]
206206
"""
207207
self._check_in_scopes(code, raises=NameError)
208208

209-
@unittest.expectedFailure # TODO: RUSTPYTHON; SyntaxError: compiler_make_closure: cannot find '__classdict__' in parent vars
210209
def test_references___classdict___nested(self):
211210
class _C:
212-
# res = [(lambda: __classdict__)() for _ in [1]] # TODO: RUSTPYTHON
213-
pass # TODO: RUSTPYTHON
211+
res = [(lambda: __classdict__)() for _ in [1]]
214212
self.assertIn("res", _C.res[0])
215213

216214
def test_references___conditional_annotations__(self):

Lib/test/test_patma.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import inspect
77
import sys
88
import unittest
9+
from test import support
910

1011

1112
@dataclasses.dataclass
@@ -2563,15 +2564,14 @@ def test_patma_240(self):
25632564
self.assertEqual(y, 0)
25642565
self.assertEqual(z, {0: 1})
25652566

2566-
# TODO: RUSTPYTHON
2567-
# def test_patma_241(self):
2568-
# x = [[{0: 0}]]
2569-
# match x:
2570-
# case list([({-0-0j: int(real=0+0j, imag=0-0j) | (1) as z},)]):
2571-
# y = 0
2572-
# self.assertEqual(x, [[{0: 0}]])
2573-
# self.assertEqual(y, 0)
2574-
# self.assertEqual(z, 0)
2567+
def test_patma_241(self):
2568+
x = [[{0: 0}]]
2569+
match x:
2570+
case list([({-0-0j: int(real=0+0j, imag=0-0j) | (1) as z},)]):
2571+
y = 0
2572+
self.assertEqual(x, [[{0: 0}]])
2573+
self.assertEqual(y, 0)
2574+
self.assertEqual(z, 0)
25752575

25762576
def test_patma_242(self):
25772577
x = range(3)
@@ -3016,6 +3016,13 @@ def test_multiple_assignments_to_name_in_pattern_5(self):
30163016
pass
30173017
""")
30183018

3019+
def test_multiple_assignments_to_name_in_pattern_6(self):
3020+
self.assert_syntax_error("""
3021+
match ...:
3022+
case a as a + 1: # NAME and expression with no ()
3023+
pass
3024+
""")
3025+
30193026
def test_multiple_starred_names_in_sequence_pattern_0(self):
30203027
self.assert_syntax_error("""
30213028
match ...:
@@ -3492,6 +3499,7 @@ def f(command): # 0
34923499
self.assertListEqual(self._trace(f, 1), [1, 2, 3])
34933500
self.assertListEqual(self._trace(f, 0), [1, 2, 5, 6])
34943501

3502+
@support.skip_wasi_stack_overflow()
34953503
def test_parser_deeply_nested_patterns(self):
34963504
# Deeply nested patterns can cause exponential backtracking when parsing.
34973505
# See gh-93671 for more information.

Lib/test/test_pep646_syntax.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,7 @@
321321
__test__ = {'doctests' : doctests}
322322

323323
def load_tests(loader, tests, pattern):
324-
from test.support.rustpython import DocTestChecker # TODO: RUSTPYTHON
325-
tests.addTest(doctest.DocTestSuite(checker=DocTestChecker())) # TODO: RUSTPYTHON
324+
tests.addTest(doctest.DocTestSuite())
326325
return tests
327326

328327

Lib/test/test_super.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,15 @@ def f():
112112
__class__""", globals(), {})
113113
self.assertIs(type(e.exception), NameError) # Not UnboundLocalError
114114
class X:
115-
# global __class__ # TODO: RUSTPYTHON; SyntaxError: name '__class__' is assigned to before global declaration
115+
global __class__
116116
__class__ = 42
117117
def f():
118118
__class__
119119
self.assertEqual(globals()["__class__"], 42)
120120
del globals()["__class__"]
121121
self.assertNotIn("__class__", X.__dict__)
122122
class X:
123-
# nonlocal __class__ # TODO: RUSTPYTHON; SyntaxError: name '__class__' is assigned to before nonlocal declaration
123+
nonlocal __class__
124124
__class__ = 42
125125
def f():
126126
__class__

0 commit comments

Comments
 (0)