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

Method test_long_rule_str

Lib/test/test_peg_generator/test_pegen.py:54–70  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

52 parse_string(grammar_source, GrammarParser)
53
54 def test_long_rule_str(self) -> None:
55 grammar_source = """
56 start: zero | one | one zero | one one | one zero zero | one zero one | one one zero | one one one
57 """
58 expected = """
59 start:
60 | zero
61 | one
62 | one zero
63 | one one
64 | one zero zero
65 | one zero one
66 | one one zero
67 | one one one
68 """
69 grammar: Grammar = parse_string(grammar_source, GrammarParser)
70 self.assertEqual(str(grammar.rules["start"]), textwrap.dedent(expected).strip())
71
72 def test_typed_rules(self) -> None:
73 grammar = """

Callers

nothing calls this directly

Calls 5

parse_stringFunction · 0.90
strFunction · 0.85
assertEqualMethod · 0.45
stripMethod · 0.45
dedentMethod · 0.45

Tested by

no test coverage detected