Skip to content

Commit fae6d35

Browse files
committed
revert: Replace broken doctests
1 parent 21912c2 commit fae6d35

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

graphs/graph_list.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class GraphAdjacencyList(Generic[T]):
1818
1919
Directed graph example:
2020
>>> d_graph = GraphAdjacencyList()
21-
>>> d_graph
21+
>>> print(d_graph)
2222
{}
2323
>>> d_graph.add_edge(0, 1)
2424
{0: [1], 1: []}
@@ -28,7 +28,7 @@ class GraphAdjacencyList(Generic[T]):
2828
{0: [1], 1: [2, 4, 5], 2: [0, 6, 7], 4: [], 5: [], 6: [], 7: []}
2929
>>> d_graph
3030
{0: [1], 1: [2, 4, 5], 2: [0, 6, 7], 4: [], 5: [], 6: [], 7: []}
31-
>>> repr(d_graph)
31+
>>> print(repr(d_graph))
3232
{0: [1], 1: [2, 4, 5], 2: [0, 6, 7], 4: [], 5: [], 6: [], 7: []}
3333
3434
Undirected graph example:
@@ -47,15 +47,15 @@ class GraphAdjacencyList(Generic[T]):
4747
5: [1, 4],
4848
6: [2],
4949
7: [2]}
50-
>>> u_graph
50+
>>> print(u_graph)
5151
{0: [1, 2],
5252
1: [0, 2, 4, 5],
5353
2: [1, 0, 6, 7],
5454
4: [1, 5],
5555
5: [1, 4],
5656
6: [2],
5757
7: [2]}
58-
>>> repr(u_graph)
58+
>>> print(repr(u_graph))
5959
{0: [1, 2],
6060
1: [0, 2, 4, 5],
6161
2: [1, 0, 6, 7],
@@ -148,3 +148,7 @@ def add_edge(
148148

149149
def __repr__(self) -> str:
150150
return pformat(self.adj_list)
151+
152+
import doctest
153+
154+
doctest.testmod()

graphs/minimum_spanning_tree_boruvka.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def boruvka_mst(graph):
154154
>>> g = Graph.build([0, 1, 2, 3], [[0, 1, 1], [0, 2, 1],[2, 3, 1]])
155155
>>> g.distinct_weight()
156156
>>> bg = Graph.boruvka_mst(g)
157-
>>> bg
157+
>>> print(bg)
158158
1 -> 0 == 1
159159
2 -> 0 == 2
160160
0 -> 1 == 1

0 commit comments

Comments
 (0)