Show More
@@ -31,11 +31,12 b' from IPython.testing.tools import mute_warn' | |||
|
31 | 31 | |
|
32 | 32 | from IPython.config.loader import ( |
|
33 | 33 | Config, |
|
34 | LazyConfigValue, | |
|
34 | 35 | PyFileConfigLoader, |
|
35 | 36 | KeyValueConfigLoader, |
|
36 | 37 | ArgParseConfigLoader, |
|
37 | 38 | KVArgParseConfigLoader, |
|
38 | ConfigError | |
|
39 | ConfigError, | |
|
39 | 40 | ) |
|
40 | 41 | |
|
41 | 42 | #----------------------------------------------------------------------------- |
@@ -207,14 +208,15 b' class TestConfig(TestCase):' | |||
|
207 | 208 | |
|
208 | 209 | def test_auto_section(self): |
|
209 | 210 | c = Config() |
|
210 |
self.assert |
|
|
211 |
|
|
|
211 | self.assertNotIn('A', c) | |
|
212 | assert not c._has_section('A') | |
|
212 | 213 | A = c.A |
|
213 | 214 | A.foo = 'hi there' |
|
214 |
self.assert |
|
|
215 | self.assertIn('A', c) | |
|
216 | assert c._has_section('A') | |
|
215 | 217 | self.assertEqual(c.A.foo, 'hi there') |
|
216 | 218 | del c.A |
|
217 |
self.assertEqual( |
|
|
219 | self.assertEqual(c.A, Config()) | |
|
218 | 220 | |
|
219 | 221 | def test_merge_doesnt_exist(self): |
|
220 | 222 | c1 = Config() |
@@ -295,3 +297,31 b' class TestConfig(TestCase):' | |||
|
295 | 297 | cfg2 = pickle.loads(pcfg) |
|
296 | 298 | self.assertEqual(cfg2, cfg) |
|
297 | 299 | |
|
300 | def test_getattr_section(self): | |
|
301 | cfg = Config() | |
|
302 | self.assertNotIn('Foo', cfg) | |
|
303 | Foo = cfg.Foo | |
|
304 | assert isinstance(Foo, Config) | |
|
305 | self.assertIn('Foo', cfg) | |
|
306 | ||
|
307 | def test_getitem_section(self): | |
|
308 | cfg = Config() | |
|
309 | self.assertNotIn('Foo', cfg) | |
|
310 | Foo = cfg['Foo'] | |
|
311 | assert isinstance(Foo, Config) | |
|
312 | self.assertIn('Foo', cfg) | |
|
313 | ||
|
314 | def test_getattr_not_section(self): | |
|
315 | cfg = Config() | |
|
316 | self.assertNotIn('foo', cfg) | |
|
317 | foo = cfg.foo | |
|
318 | assert isinstance(foo, LazyConfigValue) | |
|
319 | self.assertIn('foo', cfg) | |
|
320 | ||
|
321 | def test_getitem_not_section(self): | |
|
322 | cfg = Config() | |
|
323 | self.assertNotIn('foo', cfg) | |
|
324 | foo = cfg['foo'] | |
|
325 | assert isinstance(foo, LazyConfigValue) | |
|
326 | self.assertIn('foo', cfg) | |
|
327 |
General Comments 0
You need to be logged in to leave comments.
Login now