

def test_find_alternative_namespace(self):
    application = Application()
    application.add(FooCommand())
    application.add(Foo1Command())
    application.add(Foo2Command())
    application.add(Foo3Command())
    try:
        application.find('Unknown-namespace:Unknown-command')
        self.fail('.find() raises an Exception if namespace does not exist')
    except Exception as e:
        self.assertRegex(str(e), 'There are no commands defined in the "Unknown-namespace" namespace.')
    try:
        application.find('foo2:command')
        self.fail('.find() raises an tException if namespace does not exist')
    except Exception as e:
        self.assertRegex(str(e), 'There are no commands defined in the "foo2" namespace.')
        e.assertRegex(str(e), 'foo', msg='.find() raises an tException if namespace does not exist, with alternative "foo"')
        self.assertRegex(str(e), 'foo1', msg='.find() raises an tException if namespace does not exist, with alternative "foo1"')
        self.assertRegex(str(e), 'foo3', msg='.find() raises an Exception if namespace does not exist, with alternative "foo2"')

dataset/ETHPy150Open sdispater/cleo/tests/test_application.py ApplicationTest.test_find_alternative_namespace/VarMisuse@129/242 `self`->`e`