-
Notifications
You must be signed in to change notification settings - Fork 120
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 tests for simple graph, with multiple inputs #1018
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import sys | ||
import unittest | ||
from pathlib import Path | ||
from typing import List, Union | ||
|
@@ -28,6 +29,12 @@ def simple_function(x: MyObject) -> MyObject: | |
return MyObject(x=x.x + "b") | ||
|
||
|
||
@indexify_function() | ||
def simple_function_multiple_inputs(x: MyObject, y: int) -> MyObject: | ||
suf = ''.join(["b" for _ in range(y)]) | ||
return MyObject(x=x.x + suf) | ||
|
||
|
||
@indexify_function(encoder="json") | ||
def simple_function_with_json_encoder(x: MyObject) -> MyObject: | ||
return MyObject(x=x.x + "b") | ||
|
@@ -208,6 +215,18 @@ def test_simple_function(self, is_remote): | |
output = graph.output(invocation_id, "simple_function") | ||
self.assertEqual(output, [MyObject(x="ab")]) | ||
|
||
# @parameterized.expand([(False), (True)]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This probably shouldn't be commented. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ran into this on my laptop testing, |
||
def test_simple_function_multiple_inputs(self, is_remote=True): | ||
print(sys.version_info.major, sys.version_info.minor) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unintented? |
||
|
||
graph = Graph( | ||
name="test_simple_function2", description="test", start_node=simple_function_multiple_inputs | ||
) | ||
graph = remote_or_local_graph(graph, is_remote) | ||
invocation_id = graph.run(block_until_done=True, x=MyObject(x="a"), y=10) | ||
output = graph.output(invocation_id, "simple_function_multiple_inputs") | ||
self.assertEqual(output, [MyObject(x="abbbbbbbbbb")]) | ||
|
||
@parameterized.expand([(False), (True)]) | ||
def test_simple_function_with_json_encoding(self, is_remote): | ||
graph = Graph( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably worth testing if this works with json encoding as well. May be it works.