def dummy_test_config(): d = Config(a=1, b=2) d.update(a=2, b=3) d.a = 9 d.update(Config(b=6, f=5)) d.pop('b') print(d)
def test_config(self): d = Config(a=1, b=2) self.assertTrue(hasattr(d, 'a')) self.assertTrue(hasattr(d, 'b')) self.assertTrue(hasattr(d, 'non-exist')) self.assertIs(d.a, 1) self.assertIs(d.b, 2) d.update(a=2, b=3) self.assertIs(d.a, 2) self.assertIs(d.b, 3) d.a = 9 self.assertIs(d.a, 9) d.update(Config(b=6, f=5)) self.assertIs(d.b, 6) self.assertIs(d.f, 5) d.pop('b') self.assertIsNone(d.b)