| 279 | assert "big_camel" in dir(a) |
| 280 | |
| 281 | def test_update(self): |
| 282 | a = Box(test_dict) |
| 283 | a.grand = 1000 |
| 284 | a.update({"key1": {"new": 5}, "Key 2": {"add_key": 6}, "lister": ["a"]}) |
| 285 | a.update([("asdf", "fdsa")]) |
| 286 | a.update(testkey=66) |
| 287 | a.update({"items": {"test": "pme"}}) |
| 288 | a.update({"key1": {"gg": 4}}) |
| 289 | b = Box() |
| 290 | b.update(item=1) |
| 291 | b.update(E=1) |
| 292 | b.update(__m=1) |
| 293 | with pytest.raises(ValueError): |
| 294 | b.update("test") |
| 295 | |
| 296 | assert a.grand == 1000 |
| 297 | assert a["grand"] == 1000 |
| 298 | assert isinstance(a["items"], Box) |
| 299 | assert a["items"].test == "pme" |
| 300 | assert a["Key 2"].add_key == 6 |
| 301 | assert isinstance(a.key1, Box) |
| 302 | assert isinstance(a.lister, BoxList) |
| 303 | assert a.asdf == "fdsa" |
| 304 | assert a.testkey == 66 |
| 305 | assert a.key1.gg == 4 |
| 306 | assert "new" not in a.key1.keys() |
| 307 | |
| 308 | @pytest.mark.parametrize("source_type", [dict, list, iter]) |
| 309 | def test_update_source_and_keywords(self, source_type): |