| 584 | getattr(bx, "(3, 4)") |
| 585 | |
| 586 | def test_frozen(self): |
| 587 | bx = Box(extended_test_dict, frozen_box=True) |
| 588 | |
| 589 | assert isinstance(bx.alist, tuple) |
| 590 | assert bx.alist[0] == {"a": 1} |
| 591 | with pytest.raises(BoxError): |
| 592 | bx.new = 3 |
| 593 | |
| 594 | with pytest.raises(BoxError): |
| 595 | bx["new"] = 3 |
| 596 | |
| 597 | with pytest.raises(BoxError): |
| 598 | del bx["not"] |
| 599 | |
| 600 | with pytest.raises(BoxError): |
| 601 | delattr(bx, "key1") |
| 602 | |
| 603 | with pytest.raises(TypeError): |
| 604 | hash(bx) |
| 605 | |
| 606 | with pytest.raises(BoxError): |
| 607 | bx.clear() |
| 608 | |
| 609 | with pytest.raises(BoxError): |
| 610 | bx.pop("alist") |
| 611 | |
| 612 | with pytest.raises(BoxError): |
| 613 | bx.popitem() |
| 614 | |
| 615 | with pytest.raises(BoxError): |
| 616 | bx.popitem() |
| 617 | |
| 618 | with pytest.raises(BoxError): |
| 619 | bx.update({"another_list": []}) |
| 620 | |
| 621 | bx2 = Box(test_dict) |
| 622 | with pytest.raises(TypeError): |
| 623 | hash(bx2) |
| 624 | |
| 625 | bx3 = Box(test_dict, frozen_box=True) |
| 626 | |
| 627 | assert hash(bx3) |
| 628 | |
| 629 | def test_frozen_box_with_lists_is_serializable(self): |
| 630 | # frozen_box stores lists as tuples of Boxes; to_dict must convert the |