11from pathlib import Path
22import pytest
3- from typing import Literal
3+ from typing import Literal , Tuple
44
55import algosdk .abi
66
1111from tests .abi_roundtrip import ABIRoundtrip
1212from tests .compile_asserts import assert_teal_as_expected
1313
14+ GAI_ISSUE_2050 = "https://github.com/algorand/go-algorand-internal/issues/2050"
15+ BAD_TEALS = {
16+ "()" : GAI_ISSUE_2050 ,
17+ }
18+
19+
20+ GAI_ISSUE_2068 = "https://github.com/algorand/go-algorand-internal/issues/2068"
21+ BAD_TYPES = {
22+ "account" : GAI_ISSUE_2068 ,
23+ "asset" : GAI_ISSUE_2068 ,
24+ "application" : GAI_ISSUE_2068 ,
25+ }
26+
1427PATH = Path .cwd () / "tests" / "integration"
1528FIXTURES = PATH / "teal"
1629GENERATED = PATH / "generated"
@@ -104,6 +117,7 @@ def roundtrip_setup(abi_type):
104117
105118 return (
106119 abi_type ,
120+ str (abi .type_spec_from_annotation (abi_type )),
107121 dynamic_length ,
108122 ABIRoundtrip (abi .make (abi_type ), length = dynamic_length ).pytealer (),
109123 )
@@ -141,10 +155,12 @@ def get_subclasses(cls):
141155@pytest .mark .parametrize ("abi_type" , ABI_TYPES )
142156def test_pure_compilation (abi_type ):
143157 print (f"Pure Compilation Test for { abi_type = } " )
144- abi_type , dynamic_length , roundtripper = roundtrip_setup (abi_type )
158+ abi_type , type_str , dynamic_length , roundtripper = roundtrip_setup (abi_type )
145159
146- # TODO: Remove once we have necessary bits in SDK for reference types
147- if abi_type in [abi .Account , abi .Asset , abi .Application ]:
160+ if str (type_str ) in BAD_TYPES :
161+ print (
162+ f"Skipping encoding roundtrip test of '{ abi_type } ' because of { BAD_TYPES [type_str ]} "
163+ )
148164 return
149165
150166 sdk_abi_type = abi .algosdk_from_annotation (abi_type )
@@ -171,22 +187,17 @@ def test_pure_compilation(abi_type):
171187 assert_teal_as_expected (save_to , FIXTURES / "roundtrip" / filename )
172188
173189
174- GAI_ISSUE_2050 = "https://github.com/algorand/go-algorand-internal/issues/2050"
175-
176- BAD_TEALS = {
177- "()" : GAI_ISSUE_2050 ,
178- }
179-
180-
181190@pytest .mark .parametrize ("abi_type" , ABI_TYPES )
182191def test_roundtrip (abi_type ):
183192 print (f"Round Trip Test for { abi_type = } " )
184193
185- # TODO: Remove when we have SDK support
186- if abi_type in [abi .Account , abi .Asset , abi .Application ]:
187- return
194+ _ , type_str , dynamic_length , roundtripper = roundtrip_setup (abi_type )
188195
189- _ , dynamic_length , roundtripper = roundtrip_setup (abi_type )
196+ if type_str in BAD_TYPES :
197+ print (
198+ f"Skipping encoding roundtrip test of '{ abi_type } ' because of { BAD_TYPES [type_str ]} "
199+ )
200+ return
190201
191202 sdk_abi_types = roundtripper .abi_argument_types ()
192203 sdk_ret_type = roundtripper .abi_return_type ()
0 commit comments