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