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

Method get_match_case_values

Lib/test/test_ast/test_ast.py:3729–3743  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

3727
3728 def test_folding_match_case_allowed_expressions(self):
3729 def get_match_case_values(node):
3730 result = []
3731 if isinstance(node, ast.Constant):
3732 result.append(node.value)
3733 elif isinstance(node, ast.MatchValue):
3734 result.extend(get_match_case_values(node.value))
3735 elif isinstance(node, ast.MatchMapping):
3736 for key in node.keys:
3737 result.extend(get_match_case_values(key))
3738 elif isinstance(node, ast.MatchSequence):
3739 for pat in node.patterns:
3740 result.extend(get_match_case_values(pat))
3741 else:
3742 self.fail(f"Unexpected node {node}")
3743 return result
3744
3745 tests = [
3746 ("-0", [0]),

Callers

nothing calls this directly

Calls 3

appendMethod · 0.45
extendMethod · 0.45
failMethod · 0.45

Tested by

no test coverage detected