Skip to content

Commit e844a21

Browse files
Ensures that A and B are actual nodes with a .name attribute
1 parent 2207194 commit e844a21

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tests/test_graph_snapshots.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
import unittest
22
import time
33
from pydatastructs.graphs import Graph
4+
from pydatastructs.utils import AdjacencyListGraphNode, AdjacencyMatrixGraphNode
45

56
class TestGraphSnapshots(unittest.TestCase):
67
def test_snapshot_creation(self):
78
graph = Graph(implementation='adjacency_list')
8-
graph.add_vertex("A")
9-
graph.add_vertex("B")
9+
graph.add_vertex(AdjacencyListGraphNode("A"))
10+
graph.add_vertex(AdjacencyListGraphNode("B"))
1011
graph.add_edge("A", "B", cost=5)
1112
graph.add_snapshot()
1213

1314
self.assertEqual(len(graph.list_snapshots()), 1)
1415

1516
def test_snapshot_retrieval(self):
1617
graph = Graph(implementation='adjacency_list')
17-
graph.add_vertex("A")
18-
graph.add_vertex("B")
18+
graph.add_vertex(AdjacencyListGraphNode("A"))
19+
graph.add_vertex(AdjacencyListGraphNode("B"))
1920
graph.add_edge("A", "B", cost=5)
2021
graph.add_snapshot()
2122
snapshot_time = graph.list_snapshots()[0]

0 commit comments

Comments
 (0)