-
Notifications
You must be signed in to change notification settings - Fork 1
fix: fixes type checking of tuples with primitive types #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
71fdd5f
8189ec8
49592d7
fd24e5f
06b2a7f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,10 @@ | |
|
||
import pytest | ||
from _algopy_testing import arc4 | ||
from algopy_testing import AlgopyTestContext, algopy_testing_context | ||
from algosdk import abi | ||
|
||
from tests.artifacts.Tuples.contract import TuplesContract | ||
from tests.util import int_to_bytes | ||
|
||
_abi_string = "hello" | ||
|
@@ -15,6 +17,14 @@ | |
_arc4_uint8 = arc4.UInt8(42) | ||
_arc4_bool = arc4.Bool(True) | ||
|
||
|
||
# New fixture | ||
@pytest.fixture() | ||
def context() -> typing.Generator[AlgopyTestContext, None, None]: | ||
with algopy_testing_context() as ctx: | ||
yield ctx | ||
|
||
|
||
_test_data = [ | ||
( | ||
abi.ABIType.from_string("(uint8,bool,bool)"), | ||
|
@@ -279,3 +289,8 @@ def _compare_abi_and_arc4_values( | |
assert arc4_value.native == abi_value | ||
else: | ||
assert arc4_value.bytes == int_to_bytes(abi_value, len(arc4_value.bytes)) | ||
|
||
|
||
def test_tuple_return_with_primitive_type(context: AlgopyTestContext) -> None: # noqa: ARG001 | ||
boblat marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @daniel-makerx The error is unique to versions of python starting from 3.13 and higher python/cpython#101162 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a ci to run in matrix, here is a run from temporary commit reverting original code back you can see several tests failing due to new behaviour in 3.13 https://github.com/algorandfoundation/algorand-python-testing/actions/runs/15044342246/job/42283130835?pr=39 |
||
contract = TuplesContract() | ||
contract.test_tuple_with_primitive_type() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from algopy import ( | ||
ARC4Contract, | ||
UInt64, | ||
arc4, | ||
) | ||
|
||
|
||
class TuplesContract(ARC4Contract, avm_version=11): | ||
@arc4.abimethod() | ||
def test_tuple_with_primitive_type(self) -> tuple[UInt64, bool]: | ||
return (UInt64(0), True) |
Uh oh!
There was an error while loading. Please reload this page.