|
2 | 2 | import typing |
3 | 3 |
|
4 | 4 | import pytest |
| 5 | +from _algopy_testing import algopy_testing_context |
5 | 6 | from _algopy_testing.constants import MAX_BYTES_SIZE |
6 | 7 | from _algopy_testing.primitives.bytes import Bytes |
7 | 8 | from _algopy_testing.primitives.fixed_bytes import FixedBytes |
8 | 9 | from _algopy_testing.primitives.uint64 import UInt64 |
| 10 | +from _algopy_testing.state.box import Box |
9 | 11 |
|
10 | 12 | from tests.util import int_to_bytes |
11 | 13 |
|
@@ -231,9 +233,6 @@ def test_fixed_bytes_from_bytes() -> None: |
231 | 233 | assert len(fb32) == 32 |
232 | 234 | assert fb32.length == 32 |
233 | 235 |
|
234 | | - with pytest.raises(ValueError, match="expected value length <= 4096, got: 4097"): |
235 | | - FixedBytes[typing.Literal[64]].from_bytes(b"\x0f" * 4097) |
236 | | - |
237 | 236 |
|
238 | 237 | def test_fixed_bytes_from_bytes_with_bytes_object() -> None: |
239 | 238 | """Test FixedBytes.from_bytes class method with Bytes object.""" |
@@ -680,3 +679,17 @@ def test_contains_literal_bytes() -> None: |
680 | 679 | assert b"\xcd\x12" in x |
681 | 680 |
|
682 | 681 | assert (b"\xcd\x12" not in x) == False # noqa: E712 |
| 682 | + |
| 683 | + |
| 684 | +def test_big_fixed_bytes_in_box() -> None: |
| 685 | + with algopy_testing_context() as ctx: # noqa: SIM117 |
| 686 | + with ctx.txn.create_group([ctx.any.txn.application_call()]): |
| 687 | + big_box = Box(FixedBytes[typing.Literal[5000]], key=b"big") |
| 688 | + big_box.create() |
| 689 | + assert big_box.value[4999] == b"\x00" |
| 690 | + |
| 691 | + big_box.replace(4999, b"\xff") |
| 692 | + assert big_box.value[4999] == b"\xff" |
| 693 | + |
| 694 | + big_box.splice(4990, 10, b"\x7f" * 10) |
| 695 | + assert big_box.value[4990:] == b"\x7f" * 10 |
0 commit comments