-
Notifications
You must be signed in to change notification settings - Fork 11
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
60f3c52
commit 1259412
Showing
5 changed files
with
103 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
from uranium import rule | ||
|
||
|
||
def test_rule_does_not_execute(build): | ||
|
||
g = [] | ||
|
||
def rule_func(build): | ||
return True | ||
|
||
@rule(rule_func) | ||
def main(build): | ||
g.append("main") | ||
|
||
main(build) | ||
assert "main" not in g | ||
|
||
|
||
def test_all_true_multiple_rules(build): | ||
""" | ||
if all rules return true, don't execute the task | ||
""" | ||
|
||
g = [] | ||
|
||
def rule_func(build): | ||
return True | ||
|
||
def rule_func_2(build): | ||
return True | ||
|
||
@rule(rule_func) | ||
@rule(rule_func_2) | ||
def main(build): | ||
g.append("main") | ||
|
||
main(build) | ||
assert "main" not in g | ||
|
||
|
||
def test_one_false_multiple_rules(build): | ||
""" | ||
if one rule return false, execute the task | ||
""" | ||
|
||
g = [] | ||
|
||
def rule_func(build): | ||
return True | ||
|
||
def rule_func_2(build): | ||
return False | ||
|
||
@rule(rule_func) | ||
@rule(rule_func_2) | ||
def main(build): | ||
g.append("main") | ||
|
||
main(build) | ||
assert "main" in g |
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,7 @@ | ||
def experimental(func): | ||
""" | ||
tag a function within uranium as experimental. | ||
mainly for documentation purposes. | ||
""" | ||
func.experimental = True | ||
return func |
Empty file.