-
-
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.
* add pprint test for Specific * add tests for _deserialize * add serde test for RunFunctionOrConstructorAction * add tests for object search permission update * lint * address comments * Fixing linting issues and test - Fixed failing test_Floatconversion test - Removed @pytest.mark.xfail Co-authored-by: Jasopaum <[email protected]>
- Loading branch information
1 parent
4cf7f92
commit e9903b8
Showing
17 changed files
with
220 additions
and
62 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
*************************** | ||
Getting Started with PySyft | ||
*************************** | ||
*************************** |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
********************************** | ||
Step 2 - Learn the PySyft Codebase | ||
********************************** | ||
********************************** |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
******************************** | ||
Step 4 - Your First Pull Request | ||
******************************** | ||
******************************** |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
*********************************** | ||
Step 1 - Setup Your Dev Environment | ||
*********************************** | ||
*********************************** |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
************************* | ||
Launch a Duet with PySyft | ||
************************* | ||
************************* |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
*************************** | ||
Step 3 - Your First Project | ||
*************************** | ||
*************************** |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
************************ | ||
Step 5 - Join a Dev Team | ||
************************ | ||
************************ |
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 |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
bandit | ||
black | ||
dataclasses # backport to python 3.6 | ||
doc8 | ||
flake8 | ||
flask | ||
forbiddenfruit>=0.1.3 | ||
|
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
Empty file.
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,17 @@ | ||
# third party | ||
from pytest import raises | ||
|
||
# syft absolute | ||
from syft.core.common.serde.deserialize import _deserialize | ||
|
||
|
||
def test_fail_deserialize_no_format() -> None: | ||
with raises( | ||
ValueError, match="Please pick the format of the data on the deserialization" | ||
): | ||
_deserialize(blob="to deserialize", from_proto=False) | ||
|
||
|
||
def test_fail_deserialize_wrong_format() -> None: | ||
with raises(TypeError, match="You tried to deserialize an unsupported type."): | ||
_deserialize(blob="to deserialize") |
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
43 changes: 43 additions & 0 deletions
43
tests/syft/core/node/common/action/function_or_constructor_action_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,43 @@ | ||
# third party | ||
import torch as th | ||
|
||
# syft absolute | ||
import syft as sy | ||
from syft.core.common.uid import UID | ||
from syft.core.node.common.action.function_or_constructor_action import ( | ||
RunFunctionOrConstructorAction, | ||
) | ||
|
||
# TODO test execution | ||
# TODO test permissions | ||
|
||
|
||
def test_run_function_or_constructor_action_serde() -> None: | ||
alice = sy.VirtualMachine(name="alice") | ||
alice_client = alice.get_client() | ||
|
||
args = ( | ||
th.tensor([1, 2, 3]).send(alice_client), | ||
th.tensor([4, 5, 5]).send(alice_client), | ||
) | ||
|
||
msg = RunFunctionOrConstructorAction( | ||
path="torch.Tensor.add", | ||
args=args, | ||
kwargs={}, | ||
id_at_location=UID(), | ||
address=alice_client.address, | ||
msg_id=UID(), | ||
) | ||
|
||
blob = msg.serialize() | ||
|
||
msg2 = sy.deserialize(blob=blob) | ||
|
||
assert msg2.path == msg.path | ||
# FIXME this cannot be checked before we fix the Pointer serde problem (see _proto2object in Pointer) | ||
# assert msg2.args == msg.args | ||
assert msg2.kwargs == msg.kwargs | ||
assert msg2.address == msg.address | ||
assert msg2.id == msg.id | ||
assert msg2.id_at_location == msg.id_at_location |
Oops, something went wrong.