def test_int_opts(self): conf = Config() value = conf.int('section1', 'int', 1) self.assertEquals(value, 1) conf = Config({'section1': {'int': 2}}) value = conf.int('section1', 'int', 1) self.assertEquals(value, 2)
def test_int_opt_casts(self): conf = Config({'section1': {'int': 'non-numeric', 'bool': True}}) self.assertRaises(ValueError, conf.int, 'section1', 'int', 1) value = conf.int('section1', 'bool', True) self.assertEquals(value, 1)
def test_set(self): conf = Config() # Explicity set a value for a section conf.set('section1', 'int', 2) value = conf.int('section1', 'int', 1) self.assertEquals(value, 2)