Skip to content

Commit

Permalink
add serialize_pipelines test
Browse files Browse the repository at this point in the history
  • Loading branch information
g-simmons committed Aug 9, 2024
1 parent 194591c commit 41dc23b
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,41 @@ def process(self, input: Production) -> Production:
}
}
}

def test_serialize_pipelines_with_typing_types(self):
class MyProcessor(BaseProcessor):
input_types = {
"input1": List[int],
}

output_types = {
"output1": List[int],
}

def process(self, input: Production) -> Production:
return input

processor = MyProcessor()

pipeline = Pipeline("test")

pipeline.add_processor("test", processor)

server = Server(
pipelines={"default": pipeline},
)
print(server.serialize_pipelines())

assert server.serialize_pipelines() == {
"pipelines": {
"default": {
"subscribers": [],
"processors": [
{
"input_types": {"input1": "typing.List[int]"},
"output_types": {"output1": "typing.List[int]"},
}
],
}
}
}

0 comments on commit 41dc23b

Please sign in to comment.