def test_pgnode_normalize_pgnode_args(): graph = PGNode( "foo", x=PGNode("bar", color="red"), y={"from_node": PGNode("xev", color="green")}, ) assert graph.to_dict() == { "process_id": "foo", "arguments": { "x": { "from_node": { "process_id": "bar", "arguments": { "color": "red" } } }, "y": { "from_node": { "process_id": "xev", "arguments": { "color": "green" } } }, } }
def test_pgnode_to_dict_namespace(): pg = PGNode(process_id="load_collection", arguments={"collection_id": "S2"}, namespace="bar") assert pg.to_dict() == { "process_id": "load_collection", "namespace": "bar", "arguments": {"collection_id": "S2"} }
def test_pgnode_to_dict(): pg = PGNode(process_id="load_collection", arguments={"collection_id": "S2"}) assert pg.to_dict() == { "process_id": "load_collection", "arguments": { "collection_id": "S2" } }
def test_pgnode_to_dict_nested(): pg = PGNode( process_id="filter_bands", arguments={ "bands": [1, 2, 3], "data": {"from_node": PGNode( process_id="load_collection", arguments={"collection_id": "S2"} )} } ) assert pg.to_dict() == { 'process_id': 'filter_bands', 'arguments': { 'bands': [1, 2, 3], 'data': {'from_node': { 'process_id': 'load_collection', 'arguments': {'collection_id': 'S2'}, }} }, }