mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-12-18 17:20:16 +00:00
capturing print output
This commit is contained in:
parent
e4cb102d50
commit
650f3cf6e1
|
@ -18,7 +18,7 @@ def test_no_edges():
|
||||||
assert dist == expected
|
assert dist == expected
|
||||||
|
|
||||||
|
|
||||||
def test_example_input():
|
def test_example_input(capsys):
|
||||||
num_vertices = 3
|
num_vertices = 3
|
||||||
graph = [
|
graph = [
|
||||||
[float("inf"), float("inf"), float("inf")],
|
[float("inf"), float("inf"), float("inf")],
|
||||||
|
@ -35,13 +35,10 @@ def test_example_input():
|
||||||
[float("inf"), float("inf"), 0],
|
[float("inf"), float("inf"), 0],
|
||||||
]
|
]
|
||||||
dist, _ = floyd_warshall(graph, num_vertices)
|
dist, _ = floyd_warshall(graph, num_vertices)
|
||||||
|
_ = capsys.readouterr()
|
||||||
assert dist == expected
|
assert dist == expected
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
pytest.main()
|
|
||||||
|
|
||||||
|
|
||||||
def test_unreachable_vertices():
|
def test_unreachable_vertices():
|
||||||
graph = [
|
graph = [
|
||||||
[0, 1, float("inf")],
|
[0, 1, float("inf")],
|
||||||
|
|
Loading…
Reference in New Issue
Block a user