def test_find_alternative_commands(self):
        application = Application()
        application.add(FooCommand())
        application.add(Foo1Command())
        application.add(Foo2Command())

        command_name = 'Unknown command'
        try:
            application.find(command_name)
            self.fail('.find() raises an Exception if command does not exist')
        except Exception as e:
            self.assertEqual(
                'Command "%s" is not defined.' % command_name,
                str(e)
            )

        command_name = 'bar1'
        try:
            application.find(command_name)
            self.fail('.find() raises an Exception if command does not exist')
        except Exception as e:
            self.assertRegexpMatches(
                str(e),
                'Command "%s" is not defined.' % command_name
            )
            self.assertRegexpMatches(
                str(e),
                'afoobar1',
            )
            self.assertRegexpMatches(
                str(e),
                'foo:bar1',
            )
            self.assertNotRegex(
                str(e),
                'foo:bar$'
            )
dataset/ETHPy150Open sdispater/cleo/tests/test_application.py/ApplicationTest.test_find_alternative_commands/original