# Path: godot/api.py



import unittest
from godot.api \
    import Graph, Subgraph, Cluster, Node, Edge


    def test_add_nonstring_nodes(self):
        """ Test adding nodes with non-string names.
        """
        g = Graph()
        n = g.add_node(6)
        self.assertEqual(n.ID, "6")
        n = g.add_node(3.14)
        self.assertEqual(n.ID, "3.14")
        self.assertEqual(len(g), 2)


    def test_add_edge(self):
        """ Test adding edges to a graph.
        """
        g = Graph()
        n1, n2, n3 = Node("N1"), Node("N2"), Node("N3")
        g.edges.append( Edge(n1, n2) )
        g.add_edge("tail", "head", label="edge1")
        g.add_edge(n2, n3, color="blue")

        self.assertEqual(len(g.edges), 3)
        self.assertEqual(g.edges[1].label, "edge1")


    def test_add_subgraph(self):
        """ Test adding subgraphs to a graph.
        """
        g = Graph()

# Path: godot/api.py



# Path: godot/test/graph_test_case.py
import unittest
from godot.api \
    import Graph, Subgraph, Cluster, Node, Edge



    def test_add_nonstring_nodes(self):
        """ Test adding nodes with non-string names.
        """
        g = Graph()
        n = g.add_node(6)
        self.assertEqual(n.ID, "6")
        n = g.add_node(3.14)
        self.assertEqual(n.ID, "3.14")
        self.assertEqual(len(g), 2)


    def test_add_edge(self):
        """ Test adding edges to a graph.
        """
        g = Graph()
        n1, n2, n3 = Node("N1"), Node("N2"), Node("N3")
        g.edges.append( Edge(n1, n2) )
        g.add_edge("tail", "head", label="edge1")
        g.add_edge(n2, n3, color="blue")

        self.assertEqual(len(g.edges), 3)
        self.assertEqual(g.edges[1].label, "edge1")


    def test_add_subgraph(self):
        """ Test adding subgraphs to a graph.
        """
        g = Graph()

        subgraph = Subgraph(ID="sub1", level=1)