예제 #1
0
    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)
예제 #2
0
 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)
예제 #3
0
 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)