Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 2 additions & 24 deletions nx_parallel/tests/test_get_chunks.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import pytest

import nx_parallel as nxp
from nx_parallel.interface import ALGORITHMS


def get_functions_with_get_chunks(ignore_funcs=[], package_name="nx_parallel"):
Expand All @@ -30,30 +31,7 @@ def get_functions_with_get_chunks(ignore_funcs=[], package_name="nx_parallel"):


def test_get_functions_with_get_chunks():
# TODO: Instead of `expected` use ALGORTHMS from interface.py
# take care of functions like `connectivity.all_pairs_node_connectivity`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By "functions like connectivity.all_pairs_node_connectivity," I meant those with a name parameter defined in the _dispatchable decorator. For example, approximate_all_pairs_node_connectivity is not the actual name of the function in the networkx but in the name parameter of the decorator-- because the name all_pairs_node_connectivity is already used by connectivity.all_pairs_node_connectivity. The current logic-- splitting on . -- works with existing functions, but i'm not sure if there's a consistent rule for setting the name parameter in networkx. It may be worth updating the code if there is a rule or adding a comment to clarify this for future reference/maintenance.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! That makes sense — I’ll close this and keep it in mind to revisit when needed :)

expected = {
"all_pairs_all_shortest_paths",
"all_pairs_bellman_ford_path",
"all_pairs_bellman_ford_path_length",
"all_pairs_dijkstra",
"all_pairs_dijkstra_path",
"all_pairs_dijkstra_path_length",
"all_pairs_node_connectivity",
"all_pairs_shortest_path",
"all_pairs_shortest_path_length",
"approximate_all_pairs_node_connectivity",
"betweenness_centrality",
"closeness_vitality",
"edge_betweenness_centrality",
"is_reachable",
"johnson",
"local_efficiency",
"node_redundancy",
"number_of_isolates",
"square_clustering",
"tournament_is_strongly_connected",
}
expected = {algo.rsplit(".", 1)[-1] for algo in ALGORITHMS}
assert set(get_functions_with_get_chunks()) == expected


Expand Down
Loading