def test_has_get(self):
        application = Application()

        self.assertTrue(
            application.has('list'),
            msg='.has() returns true if a command is registered'
        )
        self.assertFalse(
            application.has('afoobar'),
            msg='.has() returns false if a command is not registered'
        )

        foo = FooCommand()
        application.add(foo)

        self.assertTrue(
            application.has('afoobar'),
            msg='.has() returns true if an alias is registered'
        )
        self.assertEqual(
            foo,
            application.get('foo:bar'),
            msg='.get() returns a command by name'
        )
        self.assertEqual(
            foo,
            application.get('afoobar'),
            msg='.get() returns a command by alias'
        )

        application = Application()
        application.add(foo)
        # Simulate help
        application._want_helps = True
        self.assertTrue(
            isinstance(application.get('foo:bar'), HelpCommand),
            msg='.get() returns the help command if --help is provided as the input'
        )
Application.has() and Application.get() should determine and get commands
dataset/ETHPy150Open sdispater/cleo/tests/test_application.py/ApplicationTest.test_has_get