-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into PythonFZ-patch-1
- Loading branch information
Showing
5 changed files
with
71 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,40 @@ | ||
"""Test for raising an error when building a graph.""" | ||
|
||
import dataclasses | ||
|
||
import znflow | ||
|
||
|
||
@dataclasses.dataclass | ||
class MyNode(znflow.Node): | ||
value: int | ||
|
||
def run(self): | ||
pass | ||
|
||
|
||
def test_graph_build_exception(): | ||
graph = znflow.DiGraph() | ||
|
||
try: | ||
with graph: | ||
node = MyNode(value=42) | ||
raise ValueError("This is a test") | ||
except ValueError: | ||
pass | ||
|
||
assert node.uuid in graph | ||
|
||
|
||
def test_group_build_exception(): | ||
graph = znflow.DiGraph() | ||
|
||
try: | ||
with graph.group("group") as grp: | ||
node = MyNode(value=42) | ||
raise ValueError("This is a test") | ||
except ValueError: | ||
pass | ||
|
||
assert node.uuid in graph | ||
assert node.uuid in grp |
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