MCPcopy Index your code
hub / github.com/python/cpython / test_patma_249

Method test_patma_249

Lib/test/test_patma.py:2674–2686  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2672 self.assertEqual(y, 'bar')
2673
2674 def test_patma_249(self):
2675 class C:
2676 __attr = "eggs" # mangled to _C__attr
2677 _Outer__attr = "bacon"
2678 class Outer:
2679 def f(self, x):
2680 match x:
2681 # looks up __attr, not _C__attr or _Outer__attr
2682 case C(__attr=y):
2683 return y
2684 c = C()
2685 setattr(c, "__attr", "spam") # setattr is needed because we're in a class scope
2686 self.assertEqual(Outer().f(c), "spam")
2687
2688 def test_patma_250(self):
2689 def f(x):

Callers

nothing calls this directly

Calls 4

CClass · 0.70
OuterClass · 0.70
assertEqualMethod · 0.45
fMethod · 0.45

Tested by

no test coverage detected