Skip to content

Commit

Permalink
Merge branch 'main' into wizard-automatic-label
Browse files Browse the repository at this point in the history
  • Loading branch information
merelcht authored Nov 4, 2024
2 parents 171865c + 1a18c5a commit 571116f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
4 changes: 2 additions & 2 deletions kedro-datasets/kedro_datasets/networkx/json_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ def __init__( # noqa: PLR0913
filepath: Filepath in POSIX format to the NetworkX graph JSON file.
load_args: Arguments passed on to ``networkx.node_link_graph``.
See the details in
https://networkx.org/documentation/networkx-1.9.1/reference/generated/networkx.readwrite.json_graph.node_link_graph.html
https://networkx.org/documentation/stable/reference/readwrite/generated/networkx.readwrite.json_graph.node_link_graph.html
save_args: Arguments passed on to ``networkx.node_link_data``.
See the details in
https://networkx.org/documentation/networkx-1.9.1/reference/generated/networkx.readwrite.json_graph.node_link_data.html
https://networkx.org/documentation/stable/reference/readwrite/generated/networkx.readwrite.json_graph.node_link_data.html
version: If specified, should be an instance of
``kedro.io.core.Version``. If its ``load`` attribute is
None, the latest version will be loaded. If its ``save``
Expand Down
5 changes: 2 additions & 3 deletions kedro-datasets/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ s3fs-base = ["s3fs>=2021.4"]
polars-base = ["polars>=0.18.0"]
plotly-base = ["plotly>=4.8.0, <6.0"]
delta-base = ["delta-spark>=1.0, <4.0"]
networkx-base = ["networkx~=2.4"]
networkx-base = ["networkx~=3.4"]

# Individual Datasets
api-apidataset = ["requests~=2.20"]
Expand Down Expand Up @@ -228,8 +228,7 @@ test = [
"matplotlib>=3.5, <4.0",
"memory_profiler>=0.50.0, <1.0",
"moto==5.0.0",
"networkx~=2.4",
"numpy<2",
"networkx~=3.4",
"openpyxl>=3.0.3, <4.0",
"pandas-gbq>=0.12.0",
"pandas>=2.0",
Expand Down
19 changes: 14 additions & 5 deletions kedro-datasets/tests/networkx/test_json_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ def versioned_json_dataset(filepath_json, load_version, save_version):

@pytest.fixture
def json_dataset_args(filepath_json):
return JSONDataset(
filepath=filepath_json, load_args={"attrs": ATTRS}, save_args={"attrs": ATTRS}
)
return JSONDataset(filepath=filepath_json, load_args=ATTRS, save_args=ATTRS)


@pytest.fixture()
Expand Down Expand Up @@ -70,7 +68,14 @@ def test_load_args_save_args(self, mocker, json_dataset_args, dummy_graph_data):
"networkx.node_link_data", wraps=networkx.node_link_data
)
json_dataset_args.save(dummy_graph_data)
patched_save.assert_called_once_with(dummy_graph_data, attrs=ATTRS)
patched_save.assert_called_once_with(
dummy_graph_data,
source="from",
target="to",
name="fake_id",
key="fake_key",
link="fake_link",
)

patched_load = mocker.patch(
"networkx.node_link_graph", wraps=networkx.node_link_graph
Expand All @@ -91,7 +96,11 @@ def test_load_args_save_args(self, mocker, json_dataset_args, dummy_graph_data):
{"from": 1, "to": 2},
],
},
attrs=ATTRS,
source="from",
target="to",
name="fake_id",
key="fake_key",
link="fake_link",
)
assert dummy_graph_data.nodes(data=True) == reloaded.nodes(data=True)

Expand Down

0 comments on commit 571116f

Please sign in to comment.