mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-45045: Optimize mapping patterns of structural pattern matching (GH-28043)
This commit is contained in:
parent
94b2639fad
commit
e6497fe698
2 changed files with 30 additions and 6 deletions
|
@ -2641,6 +2641,19 @@ class TestPatma(unittest.TestCase):
|
|||
self.assertEqual(f((False, range(-1, -11, -1), True)), alts[3])
|
||||
self.assertEqual(f((False, range(10, 20), True)), alts[4])
|
||||
|
||||
def test_patma_248(self):
|
||||
class C(dict):
|
||||
@staticmethod
|
||||
def get(key, default=None):
|
||||
return 'bar'
|
||||
|
||||
x = C({'foo': 'bar'})
|
||||
match x:
|
||||
case {'foo': bar}:
|
||||
y = bar
|
||||
|
||||
self.assertEqual(y, 'bar')
|
||||
|
||||
|
||||
class TestSyntaxErrors(unittest.TestCase):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue