code: def test_subcommand_overrides(self):
      def do_nothing(_):
          pass
  
      class FakeEvaluate(Subcommand):
          add_subparser_called = False
  
          def add_subparser(self, name, parser):
              subparser = parser.add_parser(
                  name, description="fake", help="fake help"
              )
  
              subparser.set_defaults(func=do_nothing)
              self.add_subparser_called = True
  
              return subparser
  
      fake_evaluate = FakeEvaluate()
  
      sys.argv = ["allennlp.run", "evaluate"]
      main(subcommand_overrides={"evaluate": fake_evaluate})
  
      assert fake_evaluate.add_subparser_called
  
file_path: magnitude/pymagnitude/third_party/allennlp/tests/commands/main_test.py
imports: from __future__ import division
  from __future__ import with_statement
  from __future__ import absolute_import
  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.testing import AllenNlpTestCase
  from io import open
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