예제 #1
0
    def test_failure(self):
        def fail(central, value, arg_type):
            raise errors.ConfigurationError('fail')

        section = basics.DictConfigSection(fail, {'list': [1, 2]})
        self.assertRaises(errors.ConfigurationError, section.render_value,
                          None, 'list', 'spoon')
예제 #2
0
 def test_misc(self):
     def convert(central, value, arg_type):
         return central, value, arg_type
     section = basics.DictConfigSection(convert, {'list': [1, 2]})
     self.assertFalse('foo' in section)
     self.assertTrue('list' in section)
     self.assertEqual(['list'], list(section.keys()))
     self.assertEqual(
         (None, [1, 2], 'spoon'), section.render_value(None, 'list', 'spoon'))