-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
support building node from a callable (#46)
One can build a node from a callable or the path of the callable.
1 parent
621dbcc
commit 11c078b
Showing
15 changed files
with
127 additions
and
55 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from aiida_worktree import build_node, Node | ||
|
||
|
||
def test_calcjob(): | ||
"""Generate a node for test.""" | ||
from aiida.calculations.arithmetic.add import ArithmeticAddCalculation | ||
|
||
ArithmeticAddNode = build_node(ArithmeticAddCalculation) | ||
assert issubclass(ArithmeticAddNode, Node) | ||
# build from path | ||
ArithmeticAddNode = build_node( | ||
"aiida.calculations.arithmetic.add.ArithmeticAddCalculation" | ||
) | ||
assert issubclass(ArithmeticAddNode, Node) | ||
|
||
|
||
def test_workchain(): | ||
from aiida.workflows.arithmetic.multiply_add import MultiplyAddWorkChain | ||
|
||
MultiplyAddWorkNode = build_node(MultiplyAddWorkChain) | ||
assert issubclass(MultiplyAddWorkNode, Node) | ||
# build from path | ||
MultiplyAddWorkNode = build_node( | ||
"aiida.workflows.arithmetic.multiply_add.MultiplyAddWorkChain" | ||
) | ||
assert issubclass(MultiplyAddWorkNode, Node) | ||
|
||
|
||
def test_calcfunction(): | ||
"""Generate a node for test.""" | ||
from aiida.engine import calcfunction | ||
|
||
@calcfunction | ||
def add(x, y): | ||
"""Calculate the square root of a number.""" | ||
return x + y | ||
|
||
AddNode = build_node(add) | ||
assert issubclass(AddNode, Node) | ||
|
||
|
||
def test_function(): | ||
"""Generate a node for test.""" | ||
from scipy.linalg import norm | ||
|
||
AddNode = build_node(norm) | ||
assert issubclass(AddNode, Node) |
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