예제 #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
예제 #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
예제 #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
예제 #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
예제 #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
예제 #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