| 393 | getattr(bx, "(3, 4)") |
| 394 | |
| 395 | def test_frozen(self): |
| 396 | bx = Box(extended_test_dict, frozen_box=True) |
| 397 | |
| 398 | assert isinstance(bx.alist, tuple) |
| 399 | assert bx.alist[0] == {"a": 1} |
| 400 | with pytest.raises(BoxError): |
| 401 | bx.new = 3 |
| 402 | |
| 403 | with pytest.raises(BoxError): |
| 404 | bx["new"] = 3 |
| 405 | |
| 406 | with pytest.raises(BoxError): |
| 407 | del bx["not"] |
| 408 | |
| 409 | with pytest.raises(BoxError): |
| 410 | delattr(bx, "key1") |
| 411 | |
| 412 | with pytest.raises(TypeError): |
| 413 | hash(bx) |
| 414 | |
| 415 | with pytest.raises(BoxError): |
| 416 | bx.clear() |
| 417 | |
| 418 | with pytest.raises(BoxError): |
| 419 | bx.pop("alist") |
| 420 | |
| 421 | with pytest.raises(BoxError): |
| 422 | bx.popitem() |
| 423 | |
| 424 | with pytest.raises(BoxError): |
| 425 | bx.popitem() |
| 426 | |
| 427 | with pytest.raises(BoxError): |
| 428 | bx.update({"another_list": []}) |
| 429 | |
| 430 | bx2 = Box(test_dict) |
| 431 | with pytest.raises(TypeError): |
| 432 | hash(bx2) |
| 433 | |
| 434 | bx3 = Box(test_dict, frozen_box=True) |
| 435 | |
| 436 | assert hash(bx3) |
| 437 | |
| 438 | def test_hashing(self): |
| 439 | bx1 = Box(t=3, g=4, frozen_box=True) |