From 1cf50f542b3b46e2101ee8cf7b443f6062a2536d 2013-06-05 17:50:18 From: MinRK Date: 2013-06-05 17:50:18 Subject: [PATCH] test Config objects from dicts --- diff --git a/IPython/config/tests/test_loader.py b/IPython/config/tests/test_loader.py index ffb94b8..d68334f 100644 --- a/IPython/config/tests/test_loader.py +++ b/IPython/config/tests/test_loader.py @@ -261,3 +261,24 @@ class TestConfig(TestCase): exec 'foo = True' in c1 self.assertEqual(c1.foo, True) self.assertRaises(ConfigError, setattr, c1, 'ValueError', 10) + + def test_fromdict(self): + c1 = Config({'Foo' : {'bar' : 1}}) + self.assertEqual(c1.Foo.__class__, Config) + self.assertEqual(c1.Foo.bar, 1) + + def test_fromdict_merge(self): + c1 = Config() + c2 = Config({'Foo' : {'bar' : 1}}) + c1._merge(c2) + self.assertEqual(c1.Foo.__class__, Config) + self.assertEqual(c1.Foo.bar, 1) + + def test_fromdict_merge2(self): + c1 = Config({'Foo' : {'baz' : 2}}) + c2 = Config({'Foo' : {'bar' : 1}}) + c1._merge(c2) + self.assertEqual(c1.Foo.__class__, Config) + self.assertEqual(c1.Foo.bar, 1) + self.assertEqual(c1.Foo.baz, 2) + self.assertRaises(AttributeError, getattr, c2.Foo, 'baz')