def test_override_existing_option_string(self): arg = CliArgumentType(options_list=('--funky', '-f')) updated_options_list = ('--something-else', '-s') arg.update(options_list=updated_options_list, validator=lambda: (), completer=lambda: ()) self.assertEqual(arg.settings['options_list'], updated_options_list) self.assertIsNotNone(arg.settings['validator']) self.assertIsNotNone(arg.settings['completer'])
def test_override_remove_validator(self): existing_options_list = ('--something-else', '-s') arg = CliArgumentType(options_list=existing_options_list, validator=lambda *args, **kwargs: ()) arg.update(validator=None) self.assertIsNone(arg.settings['validator'])
def test_dont_override_existing_option_string(self): existing_options_list = ('--something-else', '-s') arg = CliArgumentType(options_list=existing_options_list) arg.update() self.assertEqual(arg.settings['options_list'], existing_options_list)