summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/test/test_patma.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_patma.py b/Lib/test/test_patma.py
index db198f7..0ed5407 100644
--- a/Lib/test/test_patma.py
+++ b/Lib/test/test_patma.py
@@ -2654,6 +2654,20 @@ class TestPatma(unittest.TestCase):
self.assertEqual(y, 'bar')
+ def test_patma_249(self):
+ class C:
+ __attr = "eggs" # mangled to _C__attr
+ _Outer__attr = "bacon"
+ class Outer:
+ def f(self, x):
+ match x:
+ # looks up __attr, not _C__attr or _Outer__attr
+ case C(__attr=y):
+ return y
+ c = C()
+ setattr(c, "__attr", "spam") # setattr is needed because we're in a class scope
+ self.assertEqual(Outer().f(c), "spam")
+
class TestSyntaxErrors(unittest.TestCase):