|
1 | | -import re |
2 | 1 | import typing |
3 | 2 |
|
4 | 3 | import pytest |
5 | | -from _algopy_testing.utilities.size_of import size_of |
6 | | -from algopy import Account, Application, Asset, Bytes, String, UInt64, arc4 |
| 4 | +from algopy import Account, Application, Asset, Bytes, String, UInt64, arc4, size_of |
7 | 5 |
|
8 | 6 |
|
9 | 7 | class Swapped(arc4.Struct): |
@@ -52,14 +50,16 @@ def test_size_of() -> None: |
52 | 50 | assert size_of(arc4.StaticArray(arc4.Byte(), arc4.Byte())) == 2 |
53 | 51 | assert size_of(Swapped) == 52 |
54 | 52 |
|
55 | | - with pytest.raises(ValueError, match=re.compile("is dynamically sized")): |
56 | | - size_of(arc4.StaticArray[arc4.DynamicBytes, typing.Literal[7]]) |
57 | 53 |
|
58 | | - with pytest.raises(ValueError, match=re.compile("is dynamically sized")): |
59 | | - size_of(tuple[arc4.DynamicBytes, Bytes]) |
60 | | - |
61 | | - with pytest.raises(ValueError, match=re.compile("is dynamically sized")): |
62 | | - size_of(arc4.Tuple[arc4.UInt64, arc4.String]) |
63 | | - |
64 | | - with pytest.raises(ValueError, match=re.compile("is dynamically sized")): |
65 | | - size_of(MyDynamicSizedTuple) |
| 54 | +@pytest.mark.parametrize( |
| 55 | + "typ", |
| 56 | + [ |
| 57 | + arc4.StaticArray[arc4.DynamicBytes, typing.Literal[7]], |
| 58 | + tuple[arc4.DynamicBytes, Bytes], |
| 59 | + arc4.Tuple[arc4.UInt64, arc4.String], |
| 60 | + MyDynamicSizedTuple, |
| 61 | + ], |
| 62 | +) |
| 63 | +def test_size_of_dynamic(typ: type) -> None: |
| 64 | + with pytest.raises(ValueError, match="is dynamically sized"): |
| 65 | + size_of(typ) |
0 commit comments