# Path: pywr/nodes.py
# class Node(Loadable, Drawable, Connectable, BaseNode, metaclass=NodeMeta):
#     """Base object from which all other nodes inherit
# 
#     This BaseNode is not connectable by default, and the Node class should
#     be used for actual Nodes in the model. The BaseNode provides an abstract
#     class for other Node types (e.g. StorageInput) that are not directly
#     Connectable.
#     """
# 
#     __parameter_attributes__ = ("cost", "min_flow", "max_flow")
# 
#     def __init__(self, model, name, **kwargs):
#         """Initialise a new Node object
# 
#         Parameters
#         ----------
#         model : Model
#             The model the node belongs to
#         name : string
#             A unique name for the node
#         """
#         color = kwargs.pop("color", "black")
#         min_flow = pop_kwarg_parameter(kwargs, "min_flow", 0.0)
#         if min_flow is None:
#             min_flow = 0.0
#         max_flow = pop_kwarg_parameter(kwargs, "max_flow", float("inf"))
#         cost = pop_kwarg_parameter(kwargs, "cost", 0.0)
#         conversion_factor = pop_kwarg_parameter(kwargs, "conversion_factor", 1.0)
# 
#         super(Node, self).__init__(model, name, **kwargs)
# 
#         self.slots = {}
#         self.color = color
#         self.min_flow = min_flow
#         self.max_flow = max_flow
#         self.cost = cost
#         self.conversion_factor = conversion_factor
# 
#     def check(self):
#         """Check the node is valid
# 
#         Raises an exception if the node is invalid
#         """
#         pass


from pywr.nodes import Node
from fixtures import simple_linear_model, simple_storage_model


model = simple_linear_model


def test_keys_and_values(model):
    expected_names = {"Input", "Link", "Output"}
    assert set(model.nodes.keys()) == expected_names
    nodes = {node for node in model.nodes}
    assert len(nodes) == 3
    assert set(model.nodes.values()) == nodes


def test_contains(model):
    assert "Input" in model.nodes
    assert "Output" in model.nodes
    output = model.nodes["Output"]

# Path: pywr/nodes.py
# class Node(Loadable, Drawable, Connectable, BaseNode, metaclass=NodeMeta):
#     """Base object from which all other nodes inherit
# 
#     This BaseNode is not connectable by default, and the Node class should
#     be used for actual Nodes in the model. The BaseNode provides an abstract
#     class for other Node types (e.g. StorageInput) that are not directly
#     Connectable.
#     """
# 
#     __parameter_attributes__ = ("cost", "min_flow", "max_flow")
# 
#     def __init__(self, model, name, **kwargs):
#         """Initialise a new Node object
# 
#         Parameters
#         ----------
#         model : Model
#             The model the node belongs to
#         name : string
#             A unique name for the node
#         """
#         color = kwargs.pop("color", "black")
#         min_flow = pop_kwarg_parameter(kwargs, "min_flow", 0.0)
#         if min_flow is None:
#             min_flow = 0.0
#         max_flow = pop_kwarg_parameter(kwargs, "max_flow", float("inf"))
#         cost = pop_kwarg_parameter(kwargs, "cost", 0.0)
#         conversion_factor = pop_kwarg_parameter(kwargs, "conversion_factor", 1.0)
# 
#         super(Node, self).__init__(model, name, **kwargs)
# 
#         self.slots = {}
#         self.color = color
#         self.min_flow = min_flow
#         self.max_flow = max_flow
#         self.cost = cost
#         self.conversion_factor = conversion_factor
# 
#     def check(self):
#         """Check the node is valid
# 
#         Raises an exception if the node is invalid
#         """
#         pass


# Path: tests/test_node_iterator.py
from pywr.nodes import Node
from fixtures import simple_linear_model, simple_storage_model



model = simple_linear_model


def test_keys_and_values(model):
    expected_names = {"Input", "Link", "Output"}
    assert set(model.nodes.keys()) == expected_names
    nodes = {node for node in model.nodes}
    assert len(nodes) == 3
    assert set(model.nodes.values()) == nodes


def test_contains(model):
    assert "Input" in model.nodes
    assert "Output" in model.nodes
    output = model.nodes["Output"]

    assert isinstance(output, Node)