generated from pyiron/pyiron_module_template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
24 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import unittest | ||
from pyiron_ontology.parser import get_inputs_and_outputs | ||
from pyiron_workflow import Workflow | ||
from semantikon.typing import u | ||
|
||
|
||
@Workflow.wrap.as_function_node("speed") | ||
def calculate_speed( | ||
distance: u(float, units="meter"), | ||
time: u(float, units="second"), | ||
) -> u(float, units="meter/second"): | ||
return distance / time | ||
|
||
|
||
class TestParser(unittest.TestCase): | ||
def test_parser(self): | ||
c = calculate_speed() | ||
output_dict = get_inputs_and_outputs(c) | ||
for label in ["input", "output", "function", "label"]: | ||
self.assertIn(label, output_dict) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |