def test_for_getopt_get_values_with_short_form(self): c = config_manager.ConfigurationManager( use_admin_controls=True, #use_config_files=False, use_auto_help=False, argv_source=[]) source = ['-l', '10'] o = ValueSource(source) c.option_definitions.add_option('limit', default=0, short_form='l') self.assertEqual(o.get_values(c, False), {'limit': '10'}) self.assertEqual(o.get_values(c, True), {'limit': '10'})
def test_for_getopt_get_values_with_short_form(self): c = config_manager.ConfigurationManager( use_admin_controls=True, #use_config_files=False, use_auto_help=False, argv_source=[] ) source = ['-l', '10'] o = ValueSource(source) c.option_definitions.add_option('limit', default=0, short_form='l') self.assertEqual(o.get_values(c, False), {'limit': '10'}) self.assertEqual(o.get_values(c, True), {'limit': '10'})
def test_for_getopt_get_values(self): c = config_manager.ConfigurationManager( use_admin_controls=True, #use_config_files=False, use_auto_help=False, argv_source=[]) source = ['--limit', '10'] o = ValueSource(source) self.assertEqual(o.get_values(c, True), {}) self.assertRaises(NotAnOptionError, o.get_values, c, False) c.option_definitions.add_option('limit', default=0) self.assertEqual(o.get_values(c, False), {'limit': '10'}) self.assertEqual(o.get_values(c, True), {'limit': '10'}) v = o.get_values(c, True, DotDict) self.assertTrue(isinstance(v, DotDict)) v = o.get_values(c, True, DotDictWithAcquisition) self.assertTrue(isinstance(v, DotDictWithAcquisition))
def test_for_getopt_get_values(self): c = config_manager.ConfigurationManager( use_admin_controls=True, #use_config_files=False, use_auto_help=False, argv_source=[] ) source = ['--limit', '10'] o = ValueSource(source) self.assertEqual(o.get_values(c, True), {}) self.assertRaises(NotAnOptionError, o.get_values, c, False) c.option_definitions.add_option('limit', default=0) self.assertEqual(o.get_values(c, False), {'limit': '10'}) self.assertEqual(o.get_values(c, True), {'limit': '10'}) v = o.get_values(c, True, DotDict) self.assertTrue(isinstance(v, DotDict)) v = o.get_values(c, True, DotDictWithAcquisition) self.assertTrue(isinstance(v, DotDictWithAcquisition))
def test_for_getopt_basics(self): source = ['a', 'b', 'c'] o = ValueSource(source) self.assertEqual(o.argv_source, source)