Skip to content

Commit

Permalink
per PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ahangsu committed Dec 2, 2022
1 parent ede2658 commit 2285654
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pyteal/ast/subroutine_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from itertools import product
from typing import Callable, Literal, Optional, cast
from inspect import signature

import pytest
from dataclasses import dataclass
Expand Down Expand Up @@ -1326,6 +1327,11 @@ def mySubroutine_arg_10(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10):
assert len(declaration.body.args) == 2

assert isinstance(declaration.body.args[0], Proto)

proto_expr = declaration.body.args[0]
assert proto_expr.num_returns == int(return_type != pt.TealType.none)
assert proto_expr.num_args == len(signature(subr).parameters)

assert isinstance(declaration.body.args[1], type(return_value))

options_v8.setSubroutine(definition)
Expand All @@ -1335,8 +1341,7 @@ def mySubroutine_arg_10(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10):

actual, _ = declaration.__teal__(options_v8)
options_v8.setSubroutine(None)
with pt.TealComponent.Context.ExprEqualityContext():
assert actual == expected
assert actual == expected


def test_docstring_parsing_with_different_format():
Expand Down
7 changes: 7 additions & 0 deletions pyteal/compiler/compiler_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2347,6 +2347,13 @@ def approve_if_odd(condition_encoding: pt.abi.Uint32) -> pt.Expr:
clear_state=pt.OnCompleteAction.call_only(pt.Approve()),
)

with pytest.raises(pt.TealInputError) as e:
pt.Router("will-error", on_completion_actions).compile_program(
version=6, frame_pointers=True
)

assert "Try to use frame pointer with an insufficient version 6" in str(e)

_router_with_oc = pt.Router(
"ASimpleQuestionablyRobustContract", on_completion_actions
)
Expand Down

0 comments on commit 2285654

Please sign in to comment.