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'))
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'))
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'))
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'))
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')
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')
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)
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)