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