##// END OF EJS Templates
test Config objects from dicts
MinRK -
Show More
@@ -261,3 +261,24 b' class TestConfig(TestCase):'
261 exec 'foo = True' in c1
261 exec 'foo = True' in c1
262 self.assertEqual(c1.foo, True)
262 self.assertEqual(c1.foo, True)
263 self.assertRaises(ConfigError, setattr, c1, 'ValueError', 10)
263 self.assertRaises(ConfigError, setattr, c1, 'ValueError', 10)
264
265 def test_fromdict(self):
266 c1 = Config({'Foo' : {'bar' : 1}})
267 self.assertEqual(c1.Foo.__class__, Config)
268 self.assertEqual(c1.Foo.bar, 1)
269
270 def test_fromdict_merge(self):
271 c1 = Config()
272 c2 = Config({'Foo' : {'bar' : 1}})
273 c1._merge(c2)
274 self.assertEqual(c1.Foo.__class__, Config)
275 self.assertEqual(c1.Foo.bar, 1)
276
277 def test_fromdict_merge2(self):
278 c1 = Config({'Foo' : {'baz' : 2}})
279 c2 = Config({'Foo' : {'bar' : 1}})
280 c1._merge(c2)
281 self.assertEqual(c1.Foo.__class__, Config)
282 self.assertEqual(c1.Foo.bar, 1)
283 self.assertEqual(c1.Foo.baz, 2)
284 self.assertRaises(AttributeError, getattr, c2.Foo, 'baz')
General Comments 0
You need to be logged in to leave comments. Login now