Skip to content
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

add external method test #186

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions test/scenario_execution_test/test/test_external_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,25 @@ def test_dict(val: test_struct) -> int is external scenario_execution_test.exter
with open(self.tmp_file.name) as f:
result = f.read()
self.assertEqual(result, "{'mem1': 1, 'mem2': 'bar'}")

def test_success_list_with_method_output(self):
scenario_content = """
struct test_struct:
mem1: int = 3
mem2: string = "bar"

struct lib:
def test_dict(val: test_struct) -> int is external scenario_execution_test.external_methods.external_methods.test_dict()

action store_action:
file_path: string
value: list of string

scenario test:
do store_action('""" + self.tmp_file.name + """', ['test', lib.test_dict(test_struct(mem1: 1, mem2: "bar")), 'prefix' + lib.test_dict(test_struct(mem1: 2, mem2: "foo"))])
"""
self.execute(scenario_content)
self.assertTrue(self.scenario_execution.process_results())
with open(self.tmp_file.name) as f:
result = f.read()
self.assertEqual(result, "['test', \"{'mem1': 1, 'mem2': 'bar'}\", \"prefix{'mem1': 2, 'mem2': 'foo'}\"]")
Loading