summaryrefslogtreecommitdiff
path: root/networkx/algorithms/centrality/tests/test_percolation_centrality.py
diff options
context:
space:
mode:
Diffstat (limited to 'networkx/algorithms/centrality/tests/test_percolation_centrality.py')
-rw-r--r--networkx/algorithms/centrality/tests/test_percolation_centrality.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/networkx/algorithms/centrality/tests/test_percolation_centrality.py b/networkx/algorithms/centrality/tests/test_percolation_centrality.py
index 4311edb9..ad9f243d 100644
--- a/networkx/algorithms/centrality/tests/test_percolation_centrality.py
+++ b/networkx/algorithms/centrality/tests/test_percolation_centrality.py
@@ -1,5 +1,5 @@
+import pytest
import networkx as nx
-from networkx.testing import almost_equal
def example1a_G():
@@ -37,7 +37,7 @@ class TestPercolationCentrality:
p = nx.percolation_centrality(G)
p_answer = {4: 0.625, 6: 0.667}
for n in p_answer:
- assert almost_equal(p[n], p_answer[n], places=3)
+ assert p[n] == pytest.approx(p_answer[n], abs=1e-3)
def test_percolation_example1b(self):
"""percolation centrality: example 1a"""
@@ -45,7 +45,7 @@ class TestPercolationCentrality:
p = nx.percolation_centrality(G)
p_answer = {4: 0.825, 6: 0.4}
for n in p_answer:
- assert almost_equal(p[n], p_answer[n], places=3)
+ assert p[n] == pytest.approx(p_answer[n], abs=1e-3)
def test_converge_to_betweenness(self):
"""percolation centrality: should converge to betweenness
@@ -73,9 +73,9 @@ class TestPercolationCentrality:
p_states = {k: 1.0 for k, v in b_answer.items()}
p_answer = nx.percolation_centrality(G, states=p_states)
for n in sorted(G):
- assert almost_equal(p_answer[n], b_answer[n], places=3)
+ assert p_answer[n] == pytest.approx(b_answer[n], abs=1e-3)
p_states = {k: 0.3 for k, v in b_answer.items()}
p_answer = nx.percolation_centrality(G, states=p_states)
for n in sorted(G):
- assert almost_equal(p_answer[n], b_answer[n], places=3)
+ assert p_answer[n] == pytest.approx(b_answer[n], abs=1e-3)