def popitem(self): c = Config(defaults={"foo": "bar"}) assert c.popitem() == ("foo", "bar") assert c == {} c.nested = {"leafkey": "leafval"} assert c.nested.popitem() == ("leafkey", "leafval") assert c == {"nested": {}}
def clear(self): c = Config(defaults={"foo": "bar"}) c.clear() assert c == {} c.nested = {"leafkey": "leafval"} c.nested.clear() assert c == {"nested": {}}
def delitem(self): "__delitem__" c = Config(defaults={"foo": "bar"}) del c["foo"] assert c == {} c.nested = {"leafkey": "leafval"} del c.nested["leafkey"] assert c == {"nested": {}}
def delattr(self): "__delattr__" c = Config(defaults={"foo": "bar"}) del c.foo assert c == {} c.nested = {"leafkey": "leafval"} del c.nested.leafkey assert c == {"nested": {}}
def pop(self): # Root c = Config(defaults={"foo": "bar"}) assert c.pop("foo") == "bar" assert c == {} # With the default arg assert c.pop("wut", "fine then") == "fine then" # Leaf (different key to avoid AmbiguousMergeError) c.nested = {"leafkey": "leafval"} assert c.nested.pop("leafkey") == "leafval" assert c == {"nested": {}}