code: def test_optional_operator(self) -> None:
      grammar = """
          start: sum NEWLINE
          sum: term ('+' term)?
          term: NUMBER
          """
      parser_class = make_parser(grammar)
      node = parse_string("1 + 2\n", parser_class)
      self.assertEqual(
          node,
          [
              [
                  TokenInfo(
                      NUMBER,
                      string="1",
                      start=(1, 0),
                      end=(1, 1),
                      line="1 + 2\n",
                  ),
                  [
                      TokenInfo(
                          OP,
                          string="+",
                          start=(1, 2),
                          end=(1, 3),
                          line="1 + 2\n",
                      ),
                      TokenInfo(
                          NUMBER,
                          string="2",
                          start=(1, 4),
                          end=(1, 5),
                          line="1 + 2\n",
                      ),
                  ],
              ],
              TokenInfo(
                  NEWLINE,
                  string="\n",
                  start=(1, 5),
                  end=(1, 6),
                  line="1 + 2\n",
              ),
          ],
      )
      node = parse_string("1\n", parser_class)
      self.assertEqual(
          node,
          [
              [
                  TokenInfo(
                      NUMBER,
                      string="1",
                      start=(1, 0),
                      end=(1, 1),
                      line="1\n",
                  ),
                  None,
              ],
              TokenInfo(
                  NEWLINE,
                  string="\n",
                  start=(1, 1),
                  end=(1, 2),
                  line="1\n",
              ),
          ],
      )
  
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 7 for calling the TestPegen obj's underlying member method code with example usage: obj.test_optional_operator() without return types