# Path: robograph/datamodel/base/graph.py
# class Graph:
#     def __init__(self, name, nodes=None):
#     def root_node(self):
#     def nodes(self):
#     def edges(self):
#     def nxgraph(self):
#     def name(self):
#     def add_node(self, node):
#     def add_nodes(self, sequence_of_nodes):
#     def remove_node(self, node):
#     def remove_nodes(self, sequence_of_nodes):
#     def connect(self, node_from, node_to, output_label):
#     def has_isles(self):
#     def execute(self, result_label="result"):
#     def reset(self):
#     def __repr__(self):
#     def __len__(self):
# 
# Path: robograph/datamodel/base/node.py
# class Node:
#     def __init__(self, **args):
#     def name(self):
#     def requirements(self):
#     def parameters(self):
#     def output_label(self):
#     def input(self, context):
#     def set_output_label(self, output_label):
#     def output(self):
#     def execute(self):
#     def reset(self):
#     def __repr__(self):
# 
# Path: robograph/datamodel/base/exceptions.py
# class NodeOutputLabelUndefinedError(Exception):
# class GraphError(Exception):
# class NodeConnectionError(GraphError):
# class NodeDeletionError(GraphError):
# class StopGraphExecutionSignal(Exception):
# class GraphExecutionError(GraphError):


import pytest
from robograph.datamodel.base import graph, node, exceptions
    g = graph.Graph('testgraph', [leaf1, med1, med2, leaf2, root])
    g.connect(root, med1, '1')
    g.connect(root, med2, '2')
    g.connect(med1, leaf1, '3')
    g.connect(med2, leaf2, '4')
    assert not g.has_isles()
    g.remove_node(med2)
    assert g.has_isles()


def test_reset():
    n1 = WithParameters(a=1, b=2)
    n2 = WithParameters(c=1, d=2)
    g = graph.Graph('testgraph', [n1, n2])
    for n in g.nodes:
        for p in n.parameters.values():
            assert p is not None
    g.reset()
    for n in g.nodes:
        for p in n.parameters.values():
            assert p is None


def test_connect():
    n1 = WithParameters(a=1, b=2)
    n2 = WithParameters(c=1, d=2)
    g = graph.Graph('testgraph', [n1, n2])
    not_included = WithParameters(e=1, f=2)

    # Errors when trying to link nodes coming from out of the graph

# Path: robograph/datamodel/base/graph.py
# class Graph:
#     def __init__(self, name, nodes=None):
#     def root_node(self):
#     def nodes(self):
#     def edges(self):
#     def nxgraph(self):
#     def name(self):
#     def add_node(self, node):
#     def add_nodes(self, sequence_of_nodes):
#     def remove_node(self, node):
#     def remove_nodes(self, sequence_of_nodes):
#     def connect(self, node_from, node_to, output_label):
#     def has_isles(self):
#     def execute(self, result_label="result"):
#     def reset(self):
#     def __repr__(self):
#     def __len__(self):
# 
# Path: robograph/datamodel/base/node.py
# class Node:
#     def __init__(self, **args):
#     def name(self):
#     def requirements(self):
#     def parameters(self):
#     def output_label(self):
#     def input(self, context):
#     def set_output_label(self, output_label):
#     def output(self):
#     def execute(self):
#     def reset(self):
#     def __repr__(self):
# 
# Path: robograph/datamodel/base/exceptions.py
# class NodeOutputLabelUndefinedError(Exception):
# class GraphError(Exception):
# class NodeConnectionError(GraphError):
# class NodeDeletionError(GraphError):
# class StopGraphExecutionSignal(Exception):
# class GraphExecutionError(GraphError):


# Path: robograph/datamodel/tests/test_graph.py
import pytest
from robograph.datamodel.base import graph, node, exceptions

    g = graph.Graph('testgraph', [leaf1, med1, med2, leaf2, root])
    g.connect(root, med1, '1')
    g.connect(root, med2, '2')
    g.connect(med1, leaf1, '3')
    g.connect(med2, leaf2, '4')
    assert not g.has_isles()
    g.remove_node(med2)
    assert g.has_isles()


def test_reset():
    n1 = WithParameters(a=1, b=2)
    n2 = WithParameters(c=1, d=2)
    g = graph.Graph('testgraph', [n1, n2])
    for n in g.nodes:
        for p in n.parameters.values():
            assert p is not None
    g.reset()
    for n in g.nodes:
        for p in n.parameters.values():
            assert p is None


def test_connect():
    n1 = WithParameters(a=1, b=2)
    n2 = WithParameters(c=1, d=2)
    g = graph.Graph('testgraph', [n1, n2])
    not_included = WithParameters(e=1, f=2)

    # Errors when trying to link nodes coming from out of the graph

    with pytest.raises(exceptions.NodeConnectionError):