From cc9d01a0defd46a7307e1bb4dafcdc9444e142d2 Mon Sep 17 00:00:00 2001 From: Chris Trevino Date: Thu, 27 Jun 2024 16:38:01 -0700 Subject: [PATCH] coverage bump --- .../tests/unit/nodes/__init__.py | 2 ++ .../unit/{ => nodes}/test_execution_node.py | 0 .../tests/unit/nodes/test_input_node.py | 26 +++++++++++++++++++ .../tests/unit/test_graph_builder.py | 5 ++++ 4 files changed, 33 insertions(+) create mode 100644 python/reactivedataflow/tests/unit/nodes/__init__.py rename python/reactivedataflow/tests/unit/{ => nodes}/test_execution_node.py (100%) create mode 100644 python/reactivedataflow/tests/unit/nodes/test_input_node.py diff --git a/python/reactivedataflow/tests/unit/nodes/__init__.py b/python/reactivedataflow/tests/unit/nodes/__init__.py new file mode 100644 index 00000000..45b807ba --- /dev/null +++ b/python/reactivedataflow/tests/unit/nodes/__init__.py @@ -0,0 +1,2 @@ +# Copyright (c) 2024 Microsoft Corporation. +"""Tests for Nodes.""" diff --git a/python/reactivedataflow/tests/unit/test_execution_node.py b/python/reactivedataflow/tests/unit/nodes/test_execution_node.py similarity index 100% rename from python/reactivedataflow/tests/unit/test_execution_node.py rename to python/reactivedataflow/tests/unit/nodes/test_execution_node.py diff --git a/python/reactivedataflow/tests/unit/nodes/test_input_node.py b/python/reactivedataflow/tests/unit/nodes/test_input_node.py new file mode 100644 index 00000000..d67b520d --- /dev/null +++ b/python/reactivedataflow/tests/unit/nodes/test_input_node.py @@ -0,0 +1,26 @@ +# Copyright (c) 2024 Microsoft Corporation. +"""Tests for the InputNode class.""" + +import reactivex as rx + +from reactivedataflow.nodes import InputNode + + +def test_input_node_has_id(): + node = InputNode("a") + assert node.id == "a" + node.dispose() + + +def test_input_node_attach(): + node = InputNode("a") + first_attach = rx.subject.BehaviorSubject(1) + node.attach(first_attach) + assert node.output_value() == 1 + + node.attach(rx.just(2)) + assert node.output_value() == 2 + + first_attach.on_next(3) + assert node.output_value() == 2 + node.dispose() diff --git a/python/reactivedataflow/tests/unit/test_graph_builder.py b/python/reactivedataflow/tests/unit/test_graph_builder.py index 5af35299..ac5c01ad 100644 --- a/python/reactivedataflow/tests/unit/test_graph_builder.py +++ b/python/reactivedataflow/tests/unit/test_graph_builder.py @@ -184,6 +184,11 @@ def test_graph_assembler_from_schema(): # Build the graph input_stream = rx.subject.BehaviorSubject(1) graph = assembler.build(registry=registry, inputs={"input": input_stream}) + + with pytest.raises(OutputNotFoundError): + graph.output_value("fail_1") + with pytest.raises(OutputNotFoundError): + graph.output("fail_1") assert graph.output_value("result") == 32 input_stream.on_next(2) assert graph.output_value("result") == 40