-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of github.com:OpenMined/PySyft into testing-k8s-mi…
…grations
- Loading branch information
Showing
5 changed files
with
106 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
packages/syft/tests/syft/service/sync/get_set_object_test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# third party | ||
|
||
# syft absolute | ||
import syft as sy | ||
from syft.client.datasite_client import DatasiteClient | ||
from syft.service.action.action_object import ActionObject | ||
from syft.service.dataset.dataset import Dataset | ||
|
||
|
||
def get_ds_client(client: DatasiteClient) -> DatasiteClient: | ||
client.register( | ||
name="a", | ||
email="a@a.com", | ||
password="asdf", | ||
password_verify="asdf", | ||
) | ||
return client.login(email="a@a.com", password="asdf") | ||
|
||
|
||
def test_get_set_object(high_worker): | ||
high_client: DatasiteClient = high_worker.root_client | ||
_ = get_ds_client(high_client) | ||
root_datasite_client = high_worker.root_client | ||
dataset = sy.Dataset( | ||
name="local_test", | ||
asset_list=[ | ||
sy.Asset( | ||
name="local_test", | ||
data=[1, 2, 3], | ||
mock=[1, 1, 1], | ||
) | ||
], | ||
) | ||
root_datasite_client.upload_dataset(dataset) | ||
dataset = root_datasite_client.datasets[0] | ||
|
||
other_dataset = high_client.api.services.migration._get_object( | ||
uid=dataset.id, object_type=Dataset | ||
) | ||
other_dataset.server_uid = dataset.server_uid | ||
assert dataset == other_dataset | ||
other_dataset.name = "new_name" | ||
updated_dataset = high_client.api.services.migration._update_object( | ||
object=other_dataset | ||
) | ||
assert updated_dataset.name == "new_name" | ||
|
||
asset = root_datasite_client.datasets[0].assets[0] | ||
source_ao = high_client.api.services.action.get(uid=asset.action_id) | ||
ao = high_client.api.services.migration._get_object( | ||
uid=asset.action_id, object_type=ActionObject | ||
) | ||
ao._set_obj_location_( | ||
high_worker.id, | ||
root_datasite_client.credentials, | ||
) | ||
assert source_ao == ao |