Skip to content

Commit

Permalink
Added tests for txt.py
Browse files Browse the repository at this point in the history
  • Loading branch information
vadyushkins committed May 16, 2021
1 parent f2f5f6b commit 75a6c67
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion tests/graphs/readwrite/txt.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

g1 = cfpq_data.labeled_binomial_graph(42, 0.42, seed=seed, verbose=False)
g2 = cfpq_data.labeled_binomial_graph(42, 0.73, seed=seed, verbose=False)
g3 = cfpq_data.graph_from_text("1 2\n2 3", verbose=False)
g3 = cfpq_data.graph_from_text("1 2", verbose=False)


@pytest.mark.parametrize(
Expand All @@ -39,6 +39,29 @@ def test_txt(graph):
)


@pytest.mark.parametrize(
"graph",
[
g1,
g2,
g3,
],
)
def test_txt_with_quoting(graph):
(fd, fname) = tempfile.mkstemp()

path = cfpq_data.graph_to_txt(graph, fname, quoting=True, verbose=False)
gin = cfpq_data.graph_from_txt(path, verbose=False)

os.close(fd)
os.unlink(fname)

assert (
graph.number_of_nodes() == gin.number_of_nodes()
and graph.number_of_edges() == gin.number_of_edges()
)


@pytest.mark.parametrize(
"graph",
[
Expand Down

0 comments on commit 75a6c67

Please sign in to comment.