-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added few tests for /generators/duplication.py and /generators/geomet… #6976
Changes from 1 commit
85ca21c
bd52644
3ce2b48
86ce5fb
d22e478
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -249,6 +249,18 @@ def test_navigable_small_world(self): | |
gg = nx.grid_graph([5]).to_directed() | ||
assert nx.is_isomorphic(G, gg) | ||
|
||
def test_invalid_diameter_value(self): | ||
with pytest.raises(nx.NetworkXException, match=".*p must be >= 1"): | ||
nx.navigable_small_world_graph(5, p=0, q=0, dim=1) | ||
|
||
def test_invalid_long_range_connections_value(self): | ||
with pytest.raises(nx.NetworkXException, match=".*q must be >= 0"): | ||
nx.navigable_small_world_graph(5, p=1, q=-1, dim=1) | ||
|
||
def test_invalid_exponent_for_decaying_probability_value(self): | ||
with pytest.raises(nx.NetworkXException, match=".*r must be >= 0"): | ||
nx.navigable_small_world_graph(5, p=1, q=0, r=-1, dim=1) | ||
|
||
Comment on lines
+260
to
+263
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 for this. I think we should also take this opportunity to test the result when There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rossbar Added an explicit test case to test the scenario where There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks @karthikchiru12 . Out of curiosity, where did this test case come from? Are we sure that the resulting graph is indeed a valid, navigable small world graph? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I went ahead and dug a little deeper on this test case and ended up splitting it into two. The original test didn't probe the behavior of I went ahead and added a second test to probe the general behavior of |
||
|
||
class TestThresholdedRandomGeometricGraph: | ||
"""Unit tests for :func:`~networkx.thresholded_random_geometric_graph`""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super minor suggestion: providing the kwarg + using a non-extreme value makes this test ever so slightly more readable. Not a blocker though!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rossbar Added the keyword arguments in places that would improve the readability of the test case.