code: def test_typed_rules(self) -> None:
      grammar = """
          start[int]: sum NEWLINE
          sum[int]: t1=term '+' t2=term { action } | term
          term[int]: NUMBER
          """
      rules = parse_string(grammar, GrammarParser).rules
      # Check the str() and repr() of a few rules; AST nodes don't support ==.
      self.assertEqual(str(rules["start"]), "start: sum NEWLINE")
      self.assertEqual(str(rules["sum"]), "sum: term '+' term | term")
      self.assertEqual(
          repr(rules["term"]),
          "Rule('term', 'int', Rhs([Alt([NamedItem(None, NameLeaf('NUMBER'))])]))",
      )
  
imports: import ast
  import difflib
  import io
  import textwrap
  import unittest
  from test import test_tools
  from typing import Dict, Any
  from tokenize import TokenInfo, NAME, NEWLINE, NUMBER, OP
label_desc: Use image node_id 4 for calling the TestPegen obj's underlying member method code with example usage: obj.test_typed_rules() without return types