Expand governed Dataflow editor and node library
This commit is contained in:
41
tests/test_node_library.py
Normal file
41
tests/test_node_library.py
Normal file
@@ -0,0 +1,41 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import unittest
|
||||
|
||||
from govoplan_dataflow.backend.node_library import CATEGORY_LABELS, NODE_LIBRARY, NODE_TYPES
|
||||
|
||||
|
||||
class DataflowNodeLibraryTests(unittest.TestCase):
|
||||
def test_library_has_unique_executable_nodes_in_every_category(self) -> None:
|
||||
self.assertEqual(len(NODE_LIBRARY), len(NODE_TYPES))
|
||||
self.assertEqual(set(CATEGORY_LABELS), {item.category for item in NODE_LIBRARY})
|
||||
self.assertEqual(
|
||||
{
|
||||
"source.inline",
|
||||
"source.reference",
|
||||
"combine.union",
|
||||
"combine.join",
|
||||
"filter",
|
||||
"distinct",
|
||||
"select",
|
||||
"derive",
|
||||
"aggregate",
|
||||
"sort",
|
||||
"limit",
|
||||
"output",
|
||||
},
|
||||
set(NODE_TYPES),
|
||||
)
|
||||
|
||||
def test_join_and_union_publish_their_connection_contract(self) -> None:
|
||||
join = NODE_TYPES["combine.join"]
|
||||
union = NODE_TYPES["combine.union"]
|
||||
|
||||
self.assertEqual(["left", "right"], [port.id for port in join.input_ports])
|
||||
self.assertTrue(union.input_ports[0].multiple)
|
||||
self.assertEqual(2, union.input_ports[0].minimum_connections)
|
||||
self.assertEqual([], list(NODE_TYPES["output"].output_ports))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user