|
6 | 6 | import inspect |
7 | 7 | import sys |
8 | 8 | import unittest |
| 9 | +from test import support |
9 | 10 |
|
10 | 11 |
|
11 | 12 | @dataclasses.dataclass |
@@ -2563,15 +2564,14 @@ def test_patma_240(self): |
2563 | 2564 | self.assertEqual(y, 0) |
2564 | 2565 | self.assertEqual(z, {0: 1}) |
2565 | 2566 |
|
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) |
2575 | 2575 |
|
2576 | 2576 | def test_patma_242(self): |
2577 | 2577 | x = range(3) |
@@ -3016,6 +3016,13 @@ def test_multiple_assignments_to_name_in_pattern_5(self): |
3016 | 3016 | pass |
3017 | 3017 | """) |
3018 | 3018 |
|
| 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 | + |
3019 | 3026 | def test_multiple_starred_names_in_sequence_pattern_0(self): |
3020 | 3027 | self.assert_syntax_error(""" |
3021 | 3028 | match ...: |
@@ -3492,6 +3499,7 @@ def f(command): # 0 |
3492 | 3499 | self.assertListEqual(self._trace(f, 1), [1, 2, 3]) |
3493 | 3500 | self.assertListEqual(self._trace(f, 0), [1, 2, 5, 6]) |
3494 | 3501 |
|
| 3502 | + @support.skip_wasi_stack_overflow() |
3495 | 3503 | def test_parser_deeply_nested_patterns(self): |
3496 | 3504 | # Deeply nested patterns can cause exponential backtracking when parsing. |
3497 | 3505 | # See gh-93671 for more information. |
|
0 commit comments