##// END OF EJS Templates
don't allow LazyConfigValue on private names...
MinRK -
Show More
@@ -246,11 +246,13 b' class Config(dict):'
246 246 c = Config()
247 247 dict.__setitem__(self, key, c)
248 248 return c
249 else:
249 elif not key.startswith('_'):
250 250 # undefined, create lazy value, used for container methods
251 251 v = LazyConfigValue()
252 252 dict.__setitem__(self, key, v)
253 253 return v
254 else:
255 raise KeyError
254 256
255 257 def __setitem__(self, key, value):
256 258 if _is_section_key(key):
@@ -369,6 +369,14 b' class TestConfig(TestCase):'
369 369 assert isinstance(foo, LazyConfigValue)
370 370 self.assertIn('foo', cfg)
371 371
372 def test_getattr_private_missing(self):
373 cfg = Config()
374 self.assertNotIn('_repr_html_', cfg)
375 with self.assertRaises(AttributeError):
376 _ = cfg._repr_html_
377 self.assertNotIn('_repr_html_', cfg)
378 self.assertEqual(len(cfg), 0)
379
372 380 def test_getitem_not_section(self):
373 381 cfg = Config()
374 382 self.assertNotIn('foo', cfg)
General Comments 0
You need to be logged in to leave comments. Login now