summaryrefslogtreecommitdiff
path: root/networkx/readwrite
diff options
context:
space:
mode:
authorRoss Barnowski <rossbar@berkeley.edu>2021-12-12 21:55:12 -0800
committerGitHub <noreply@github.com>2021-12-12 21:55:12 -0800
commitd0d2eb5c02f8f89307eff989284912e13b3a7b73 (patch)
treef84bb432720c08ca0532cb5234adf4dd16bcc67c /networkx/readwrite
parent84b1fb60a2373966aa47eee54a82c045ac663172 (diff)
downloadnetworkx-d0d2eb5c02f8f89307eff989284912e13b3a7b73.tar.gz
Compatibility updates from testing with numpy/scipy/pytest rc's (#5226)
* Rm deprecated scipy subpkg access. * Use recwarn fixture in place of deprecated pytest pattern. * Rm unnecessary try/except from tests.
Diffstat (limited to 'networkx/readwrite')
-rw-r--r--networkx/readwrite/json_graph/tests/test_cytoscape.py11
-rw-r--r--networkx/readwrite/json_graph/tests/test_tree.py11
2 files changed, 12 insertions, 10 deletions
diff --git a/networkx/readwrite/json_graph/tests/test_cytoscape.py b/networkx/readwrite/json_graph/tests/test_cytoscape.py
index 1ce84d60..64cfa577 100644
--- a/networkx/readwrite/json_graph/tests/test_cytoscape.py
+++ b/networkx/readwrite/json_graph/tests/test_cytoscape.py
@@ -6,13 +6,14 @@ from networkx.readwrite.json_graph import cytoscape_data, cytoscape_graph
# TODO: To be removed when signature change complete in 3.0
-def test_attrs_deprecation():
+def test_attrs_deprecation(recwarn):
G = nx.path_graph(3)
+
# No warnings when `attrs` kwarg not used
- with pytest.warns(None) as record:
- data = cytoscape_data(G)
- H = cytoscape_graph(data)
- assert len(record) == 0
+ data = cytoscape_data(G)
+ H = cytoscape_graph(data)
+ assert len(recwarn) == 0
+
# Future warning raised with `attrs` kwarg
attrs = {"name": "foo", "ident": "bar"}
with pytest.warns(DeprecationWarning):
diff --git a/networkx/readwrite/json_graph/tests/test_tree.py b/networkx/readwrite/json_graph/tests/test_tree.py
index 1912870f..bfbf1816 100644
--- a/networkx/readwrite/json_graph/tests/test_tree.py
+++ b/networkx/readwrite/json_graph/tests/test_tree.py
@@ -42,13 +42,14 @@ def test_exceptions():
# NOTE: To be removed when deprecation expires in 3.0
-def test_attrs_deprecation():
+def test_attrs_deprecation(recwarn):
G = nx.path_graph(3, create_using=nx.DiGraph)
+
# No warnings when `attrs` kwarg not used
- with pytest.warns(None) as record:
- data = tree_data(G, 0)
- H = tree_graph(data)
- assert len(record) == 0
+ data = tree_data(G, 0)
+ H = tree_graph(data)
+ assert len(recwarn) == 0
+
# DeprecationWarning issued when `attrs` is used
attrs = {"id": "foo", "children": "bar"}
with pytest.warns(DeprecationWarning):