コード例 #1
0
 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'])
コード例 #2
0
 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'])
コード例 #3
0
 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'])
コード例 #4
0
 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)
コード例 #5
0
 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'])
コード例 #6
0
 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)