-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d68664e
commit 694d874
Showing
3 changed files
with
78 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
from parsl import python_app | ||
|
||
|
||
@python_app | ||
def returns_a_dict(): | ||
return {"a": "X", "b": "Y"} | ||
|
||
@python_app | ||
def returns_a_list(): | ||
return ["X", "Y"] | ||
|
||
@python_app | ||
def returns_a_class(): | ||
from dataclasses import dataclass | ||
|
||
@dataclass | ||
class MyClass: | ||
a: str = "X" | ||
b: str = "Y" | ||
|
||
return MyClass | ||
|
||
def test_returns_a_dict(): | ||
|
||
# precondition that returns_a_dict behaves | ||
# correctly | ||
assert returns_a_dict().result()["a"] == "X" | ||
|
||
# check that the deferred __getitem__ functionality works, | ||
# allowing [] to be used on an AppFuture | ||
assert returns_a_dict()["a"].result() == "X" | ||
|
||
def test_returns_a_list(): | ||
|
||
# precondition that returns_a_list behaves | ||
# correctly | ||
assert returns_a_list().result()[0] == "X" | ||
|
||
# check that the deferred __getitem__ functionality works, | ||
# allowing [] to be used on an AppFuture | ||
assert returns_a_list()[0].result() == "X" | ||
|
||
def test_returns_a_class(): | ||
|
||
# precondition that returns_a_class behaves | ||
# correctly | ||
assert returns_a_class().result().a == "X" | ||
|
||
# check that the deferred __getitem__ functionality works, | ||
# allowing [] to be used on an AppFuture | ||
assert returns_a_class().a.result() == "X" | ||
|
||
# when the result is not indexable, a sensible error should | ||
# appear in the appropriate future |
This file was deleted.
Oops, something went wrong.