PR for issue #6033 Improve test coverage for algorithms in betweenness_subset.py #6033#6083
PR for issue #6033 Improve test coverage for algorithms in betweenness_subset.py #6033#6083MridulS merged 8 commits intonetworkx:mainfrom
Conversation
| for n in sorted(G): | ||
| assert b[n] == pytest.approx(b_answer[n], abs=1e-7) | ||
|
|
||
| def test_weighted_graph(self): |
There was a problem hiding this comment.
Where was the weighted test case derived? Did you compute this by hand or was this adapted from one of the other cases?
There was a problem hiding this comment.
Hi @rossbar thank you so much for the review:) As a first contributor here, I read many of the relevant codes of betweenness and betweenness subset in networkx. The weighted test case I used here is as same as the one in both test_load_centrality.py and test_betweenness_centrality.py and I calculated the betweenness centrality by myself. Previously I thought it was the sample of weighted graph. I will initialize a new weighted graph if it cannot be used here.
| for n in sorted(G): | ||
| assert b[n] == pytest.approx(expected_b[n], abs=1e-7) | ||
|
|
||
| def test_normalized_p2(self): |
There was a problem hiding this comment.
It might be worth adding a docstring here to indicate what the test is designed to cover; i.e. the special case when n<=2 where the betweenness centrality should always be 0.
There was a problem hiding this comment.
Thank you so much for the suggestion:) I have updated the docstring.
…tweenness_subset.py networkx#6033 (networkx#6083) * Updated test_betweenness_centrality_subset.py * add test of normalized in test_betweenness_centrality_subset.py * add test of normalized in test_betweenness_centrality_subset.py * update test of normalized in test_betweenness_centrality_subset.py * update weight of test_betweenness_centrality_subset.py * add docstring * add docstring in test_betweenness_centrality_subset.py * add docstring in test_betweenness_centrality_subset.py
…tweenness_subset.py networkx#6033 (networkx#6083) * Updated test_betweenness_centrality_subset.py * add test of normalized in test_betweenness_centrality_subset.py * add test of normalized in test_betweenness_centrality_subset.py * update test of normalized in test_betweenness_centrality_subset.py * update weight of test_betweenness_centrality_subset.py * add docstring * add docstring in test_betweenness_centrality_subset.py * add docstring in test_betweenness_centrality_subset.py
…tweenness_subset.py networkx#6033 (networkx#6083) * Updated test_betweenness_centrality_subset.py * add test of normalized in test_betweenness_centrality_subset.py * add test of normalized in test_betweenness_centrality_subset.py * update test of normalized in test_betweenness_centrality_subset.py * update weight of test_betweenness_centrality_subset.py * add docstring * add docstring in test_betweenness_centrality_subset.py * add docstring in test_betweenness_centrality_subset.py
PR for issue #6033 Improve test coverage for algorithms in betweenness_subset.py #6033
Updated test_betweenness_centrality_subset.py