Beispiel #1
0
 def reinstatement_of_deleted_values_works_ok(self):
     # Sounds like a stupid thing to test, but when we have to track
     # deletions and mutations manually...it's an easy thing to overlook
     c = Config(defaults={"foo": "bar"})
     assert c.foo == "bar"
     del c["foo"]
     # Sanity checks
     assert "foo" not in c
     assert len(c) == 0
     # Put it back again...as a different value, for funsies
     c.foo = "formerly bar"
     # And make sure it stuck
     assert c.foo == "formerly bar"
Beispiel #2
0
 def supports_mutation_via_attribute_access(self):
     c = Config({"foo": "bar"})
     assert c.foo == "bar"
     c.foo = "notbar"
     assert c.foo == "notbar"
     assert c["foo"] == "notbar"