예제 #1
0
 def test_section_ref(self):
     ref = basics.HardCodedConfigSection({})
     self.assertRaises(errors.ConfigurationError, basics.convert_asis, None,
                       42, 'ref:spoon')
     self.assertIdentical(
         ref,
         basics.convert_asis(None, ref, 'ref:spoon').section)
     self.assertEqual(('ref', ref), basics.convert_asis(None, ref, 'repr'))
예제 #2
0
 def test_section_ref(self):
     ref = basics.HardCodedConfigSection({})
     self.assertRaises(errors.ConfigurationError,
         basics.convert_asis, None, 42, 'ref:spoon')
     self.assertIdentical(
         ref, basics.convert_asis(None, ref, 'ref:spoon').section)
     self.assertEqual(
         ('ref', ref), basics.convert_asis(None, ref, 'repr'))
예제 #3
0
 def test_section_refs(self):
     ref = basics.HardCodedConfigSection({})
     self.assertRaises(errors.ConfigurationError,
         basics.convert_asis, None, [1, 2], 'refs:spoon')
     self.assertIdentical(
         ref,
         basics.convert_asis(None, [ref], 'refs:spoon')[0].section)
     self.assertEqual(
         ('refs', [ref]), basics.convert_asis(None, [ref], 'repr'))
예제 #4
0
 def test_section_refs(self):
     ref = basics.HardCodedConfigSection({})
     self.assertRaises(errors.ConfigurationError, basics.convert_asis, None,
                       [1, 2], 'refs:spoon')
     self.assertIdentical(
         ref,
         basics.convert_asis(None, [ref], 'refs:spoon')[0].section)
     self.assertEqual(('refs', [ref]),
                      basics.convert_asis(None, [ref], 'repr'))
예제 #5
0
 def test_repr(self):
     for typename, value in self.source.iteritems():
         self.assertEqual(
             (typename, value),
             basics.convert_asis(None, value, 'repr'))
     self.assertRaises(
         errors.ConfigurationError,
         basics.convert_asis, None, object(), 'repr')
예제 #6
0
 def test_repr(self):
     for typename, value in self.source.items():
         self.assertEqual(
             (typename, value),
             basics.convert_asis(None, value, 'repr'))
     self.assertRaises(
         errors.ConfigurationError,
         basics.convert_asis, None, object(), 'repr')
예제 #7
0
 def test_render_value(self):
     # try all combinations
     for arg, value in self.source.iteritems():
         for typename in self.source:
             if arg == typename:
                 self.assertEqual(
                     value, basics.convert_asis(None, value, typename))
             else:
                 self.assertRaises(
                     errors.ConfigurationError,
                     basics.convert_asis, None, value, typename)
예제 #8
0
 def test_render_value(self):
     # try all combinations
     for arg, value in self.source.iteritems():
         for typename in self.source:
             if arg == typename:
                 self.assertEqual(
                     value, basics.convert_asis(None, value, typename))
             else:
                 self.assertRaises(errors.ConfigurationError,
                                   basics.convert_asis, None, value,
                                   typename)