MCPcopy Create free account
hub / github.com/python/cpython / test_patma_252

Method test_patma_252

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

Source from the content-addressed store, hash-verified

2715 self.assertIs(f(1, X(-1)), None)
2716
2717 def test_patma_252(self):
2718 # Side effects must be possible in guards:
2719 effects = []
2720 def lt(x, y):
2721 effects.append((x, y))
2722 return x < y
2723
2724 res = None
2725 match {"foo": 1}:
2726 case {"foo": x} if lt(x, 0):
2727 res = 0
2728 case {"foo": x} if lt(x, 1):
2729 res = 1
2730 case {"foo": x} if lt(x, 2):
2731 res = 2
2732
2733 self.assertEqual(res, 2)
2734 self.assertEqual(effects, [(1, 0), (1, 1), (1, 2)])
2735
2736 def test_patma_253(self):
2737 def f(v):

Callers

nothing calls this directly

Calls 2

ltFunction · 0.50
assertEqualMethod · 0.45

Tested by

no test coverage detected