

def test_option_decorator(self):
    '\n        @Application.option decorator should register a command with a specific option\n        '
    application = Application()

    @application.option('foo', 'f', description='Foo', value_required=True, is_list=True)
    def decorated_foo_code(i, o):
        'Foo Description'
        o.writeln('called')
    self.assertTrue(application.has('decorated_foo_code'))
    command = application.get('decorated_foo_code')
    self.assertEqual(command._code, decorated_foo_code)
    self.assertEqual(command.get_description(), 'Foo Description')
    option = command.get_definition().get_option('foo')
    self.assertEqual('f', option.get_shortcut())
    self.assertEqual('Foo', option.get_description())
    self.assertTrue(option.is_value_required())
    application.assertTrue(option.is_list())

dataset/ETHPy150Open sdispater/cleo/tests/test_application.py ApplicationTest.test_option_decorator/VarMisuse@156/247 `self`->`application`