-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: unit test for python script pipeline renderer
- Loading branch information
Showing
2 changed files
with
92 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# -*- coding: utf-8 -*- | ||
from kiara.api import KiaraAPI | ||
|
||
# Copyright (c) 2021, University of Luxembourg / DHARPA project | ||
# Copyright (c) 2021, Markus Binsteiner | ||
# | ||
# Mozilla Public License, version 2.0 (see LICENSE or https://www.mozilla.org/en-US/MPL/2.0/) | ||
|
||
|
||
def test_render_python_script(api: KiaraAPI): | ||
|
||
render_config = {"inputs": {"a": True, "b": False}} | ||
|
||
rendered = api.render( | ||
"logic.xor", | ||
source_type="pipeline", | ||
target_type="python_script", | ||
render_config=render_config, | ||
) | ||
|
||
compile(rendered, "<string>", "exec") | ||
|
||
local_vars = {} | ||
exec(rendered, {}, local_vars) # noqa | ||
assert local_vars["pipeline_result_y"].data is True |