def test_iter_with_parent(self): parent = Config({"test": True, "sitename": "me"}) settings = Config(YAML_DATA, parent=parent, node=mock.Mock()) self.assertCountEqual(list(settings.keys()), ["sitename", "thingy", "test"]) self.assertCountEqual(list(parent.keys()), ["test", "sitename"])
def test_copy(self): parent = Config({}) settings = Config(YAML_DATA, parent=parent, node=mock.Mock()) copied = settings.copy() self.assertNotEqual(settings, copied) self.assertEqual([i for i in settings.keys()], [i for i in copied.keys()]) self.assertEqual(settings.parent, copied.parent) settings["bob"] = "hello" self.assertNotEqual([i for i in settings.keys()], [i for i in copied.keys()])
def test_keys(self): settings = Config(YAML_DATA) self.assertCountEqual(list(settings.keys()), ["sitename", "thingy"])