Example #1
0
 def test_setdefault_without_default_with_non_existent(self):
     properties = PropertyDict({"name": "Alice"})
     value = properties.setdefault("age")
     assert properties == {"name": "Alice"}
     assert value is None
Example #2
0
 def test_setdefault_with_default_with_non_existent(self):
     properties = PropertyDict({"name": "Alice"})
     value = properties.setdefault("age", 33)
     assert properties == {"name": "Alice", "age": 33}
     assert value == 33
Example #3
0
 def test_setdefault_without_default_with_existing(self):
     properties = PropertyDict({"name": "Alice", "age": 33})
     value = properties.setdefault("age")
     assert properties == {"name": "Alice", "age": 33}
     assert value == 33