Skip to content

Commit

Permalink
feat: add unit test for missing type annotation in action definition
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgrittner committed Aug 20, 2024
1 parent 0af0a5a commit 8ffb83f
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/compiler/test_action_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,24 @@ def test_action_parser_3():
)
python_action = parse_action(MODULE_TEST_3, "test_action")
assert python_action == expected_python_action


#########################################################################################################


CODE_TEST_4 = """def custom_action1(arg: int) ->str:
print('Hey! This is my Custom Action 1')
return 'Custom Action 1'
"""


def test_missing_argument_annotation():
try:
parse_action(CODE_TEST_4, "custom_action1")
except ValueError as e:
assert (
str(e)
== "Arguments must be annotated using Annotated[<type>, ArgumentMetadata(...)]."
)
else:
assert False, "Should raise an error"

0 comments on commit 8ffb83f

Please sign in to comment.