# Path: cliff/command.py
# def _get_distributions_by_modules():
# def _get_distribution_for_module(module):
#     def __init__(self, app, app_args, cmd_name=None):
#     def _load_hooks(self):
#     def get_description(self):
#     def get_epilog(self):
#     def get_parser(self, prog_name):
#     def take_action(self, parsed_args):
#     def run(self, parsed_args):
#     def _run_before_hooks(self, parsed_args):
#     def _run_after_hooks(self, parsed_args, return_code):
# class Command(object, metaclass=abc.ABCMeta):
# 
# Path: cliff/commandmanager.py
# LOG = logging.getLogger(__name__)
# def _get_commands_by_partial_name(args, commands):
#     def __init__(self, name, command_class):
#     def load(self, require=False):
#     def __init__(self, namespace, convert_underscores=True):
#     def _load_commands(self):
#     def load_commands(self, namespace):
#     def __iter__(self):
#     def add_command(self, name, command_class):
#     def add_legacy_command(self, old_name, new_name):
#     def find_command(self, argv):
#     def _get_last_possible_command_index(self, argv):
#     def add_command_group(self, group=None):
#     def get_command_groups(self):
#     def get_command_names(self, group=None):
# class EntryPointWrapper(object):
# class CommandManager(object):


import testscenarios
from unittest import mock
from cliff import command
from cliff import commandmanager
from cliff.tests import base
from cliff.tests import utils
            self.assertIn('-b', str(err))
        else:
            self.fail('expected a failure')


class TestFindUnknownCommand(base.TestBase):

    def test(self):
        mgr = utils.TestCommandManager(utils.TEST_NAMESPACE)
        try:
            mgr.find_command(['a', 'b'])
        except ValueError as err:
            self.assertIn("['a', 'b']", str(err))
        else:
            self.fail('expected a failure')


class TestDynamicCommands(base.TestBase):

    def test_add(self):
        mgr = utils.TestCommandManager(utils.TEST_NAMESPACE)
        mock_cmd = mock.Mock()
        mgr.add_command('mock', mock_cmd)
        found_cmd, name, args = mgr.find_command(['mock'])
        self.assertIs(mock_cmd, found_cmd)

    def test_intersected_commands(self):
        def foo(arg):
            pass


# Path: cliff/command.py
# def _get_distributions_by_modules():
# def _get_distribution_for_module(module):
#     def __init__(self, app, app_args, cmd_name=None):
#     def _load_hooks(self):
#     def get_description(self):
#     def get_epilog(self):
#     def get_parser(self, prog_name):
#     def take_action(self, parsed_args):
#     def run(self, parsed_args):
#     def _run_before_hooks(self, parsed_args):
#     def _run_after_hooks(self, parsed_args, return_code):
# class Command(object, metaclass=abc.ABCMeta):
# 
# Path: cliff/commandmanager.py
# LOG = logging.getLogger(__name__)
# def _get_commands_by_partial_name(args, commands):
#     def __init__(self, name, command_class):
#     def load(self, require=False):
#     def __init__(self, namespace, convert_underscores=True):
#     def _load_commands(self):
#     def load_commands(self, namespace):
#     def __iter__(self):
#     def add_command(self, name, command_class):
#     def add_legacy_command(self, old_name, new_name):
#     def find_command(self, argv):
#     def _get_last_possible_command_index(self, argv):
#     def add_command_group(self, group=None):
#     def get_command_groups(self):
#     def get_command_names(self, group=None):
# class EntryPointWrapper(object):
# class CommandManager(object):


# Path: cliff/tests/test_commandmanager.py
import testscenarios
from unittest import mock
from cliff import command
from cliff import commandmanager
from cliff.tests import base
from cliff.tests import utils

            self.assertIn('-b', str(err))
        else:
            self.fail('expected a failure')


class TestFindUnknownCommand(base.TestBase):

    def test(self):
        mgr = utils.TestCommandManager(utils.TEST_NAMESPACE)
        try:
            mgr.find_command(['a', 'b'])
        except ValueError as err:
            self.assertIn("['a', 'b']", str(err))
        else:
            self.fail('expected a failure')


class TestDynamicCommands(base.TestBase):

    def test_add(self):
        mgr = utils.TestCommandManager(utils.TEST_NAMESPACE)
        mock_cmd = mock.Mock()
        mgr.add_command('mock', mock_cmd)
        found_cmd, name, args = mgr.find_command(['mock'])
        self.assertIs(mock_cmd, found_cmd)

    def test_intersected_commands(self):
        def foo(arg):
            pass


        def foo_bar():