示例#1
0
 def test_valid_override(self):
     expected = (b'section', b'key', b'value')
     self.assertEqual(expected, config.parse_override(b'section/key=value'))
     self.assertEqual(expected,
                      config.parse_override(b'section/key=value '))
     self.assertEqual(expected,
                      config.parse_override(b'section/key =value'))
     self.assertEqual(expected,
                      config.parse_override(b'section /key=value'))
示例#2
0
 def test_empty_override(self):
     expected = ('section', 'key', '')
     self.assertEqual(expected, config.parse_override(b'section/key='))
     self.assertEqual(expected, config.parse_override(b'section/key=  '))
示例#3
0
 def test_valid_override_is_bytes(self):
     section, key, value = config.parse_override(b'section/key=value')
     self.assertIsInstance(section, bytes)
     self.assertIsInstance(key, bytes)
     self.assertIsInstance(value, bytes)
示例#4
0
 def test_valid_override(self):
     expected = (b'section', b'key', b'value')
     self.assertEqual(expected, config.parse_override(b'section/key=value'))
     self.assertEqual(expected, config.parse_override(b'section/key=value '))
     self.assertEqual(expected, config.parse_override(b'section/key =value'))
     self.assertEqual(expected, config.parse_override(b'section /key=value'))
示例#5
0
def check_config_override(option, opt, override):
    try:
        return config_lib.parse_override(override)
    except ValueError:
        raise optparse.OptionValueError(
            'option %s: must have the format section/key=value' % opt)
示例#6
0
 def test_empty_override(self):
     expected = ('section', 'key', '')
     self.assertEqual(expected, config.parse_override(b'section/key='))
     self.assertEqual(expected, config.parse_override(b'section/key=  '))
示例#7
0
 def test_valid_override_is_bytes(self):
     section, key, value = config.parse_override(b'section/key=value')
     self.assertIsInstance(section, bytes)
     self.assertIsInstance(key, bytes)
     self.assertIsInstance(value, bytes)
示例#8
0
def check_config_override(option, opt, override):
    try:
        return config_lib.parse_override(override)
    except ValueError:
        raise optparse.OptionValueError(
            'option %s: must have the format section/key=value' % opt)