-
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.
* move group updates * add tests * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
1d431b0
commit 74b1cd3
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "znflow" | ||
version = "0.2.0" | ||
version = "0.2.1" | ||
description = "A general purpose framework for building and running computational graphs." | ||
authors = ["zincwarecode <[email protected]>"] | ||
license = "Apache-2.0" | ||
|
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