code: def test_subcommand_overrides(self):
      called = False
  
      def do_nothing(_):
          nonlocal called
          called = True
  
      @Subcommand.register("evaluate", exist_ok=True)
      class FakeEvaluate(Subcommand):  # noqa
          def add_subparser(self, parser):
              subparser = parser.add_parser(
                  self.name, description="fake", help="fake help"
              )
              subparser.set_defaults(func=do_nothing)
              return subparser
  
      sys.argv = ["allennlp", "evaluate"]
      main()
      assert called
  
file_path: allennlp/tests/commands/main_test.py
imports: import shutil
  import sys
  import pytest
  from allennlp.commands import main
  from allennlp.commands.subcommand import Subcommand
  from allennlp.common.checks import ConfigurationError
  from allennlp.common.plugins import discover_plugins
  from allennlp.common.testing import AllenNlpTestCase
  from allennlp.common.util import push_python_path, pushd
label_desc: Use image node_id 2 for calling the TestMain obj's underlying member method code with example usage: obj.test_subcommand_overrides() and returns: subparser