

def test_init_all_should_add_all_commands_to_lizy(self):

    class Base(NamedCommand):

        def __init__(self, lizy, description):
            super(Base, self).__init__(lizy, description)
        ignore_me = SubclassIgnoreMark('Base')

        def _process_command(self, lizy, args):
            pass

    class A(Command):
        NAME = 'A'
        DESC = 'A desc'

        def __init__(self, lizy):
            super(A, self).__init__(lizy, self.NAME, self.DESC)

        def _process_command(self, lizy, args):
            pass

    class BCommand(Base):
        NAME = 'B'
        DESC = 'B desc'

        def __init__(self, lizy):
            super(BCommand, self).__init__(lizy, self.DESC)

    class CCommand(Base):
        NAME = 'C'
        DESC = 'C desc'

        def __init__(self, lizy):
            super(CCommand, self).__init__(lizy, self.DESC)
    subparser_mock = (lambda : 0)
    subparser_mock.add_parser = MagicMock()
    lizy = Pylease(None, subparser_mock, None)
    Command.init_all(lizy)
    calls = [call(A.NAME, help=A.DESC), call(BCommand.NAME.lower(), help=BCommand.DESC), call(CCommand.NAME.lower(), help=CCommand.DESC)]
    subparser_mock.add_parser.assert_has_calls(calls, any_order=True)

dataset/ETHPy150Open n9code/pylease/tests/test_command.py CommandTest.test_init_all_should_add_all_commands_to_lizy/original