| 10 | |
| 11 | |
| 12 | def test_existing_fields_remain_mutable(): |
| 13 | settings = StrictBox(host="localhost", port=8000, optional=None, tags=[]) |
| 14 | settings.port = 8080 |
| 15 | settings.optional = "set" |
| 16 | settings.tags.append("local") |
| 17 | with pytest.raises(BoxKeyError, match="Cannot create field"): |
| 18 | settings.prot = 8080 |
| 19 | assert settings.to_dict() == { |
| 20 | "host": "localhost", |
| 21 | "port": 8080, |
| 22 | "optional": "set", |
| 23 | "tags": ["local"], |
| 24 | } |
| 25 | |
| 26 | |
| 27 | @pytest.mark.parametrize("method", ["item", "update", "merge_update", "setdefault", "union"]) |