-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added evaluate tests and improved implementation
- Loading branch information
Showing
3 changed files
with
152 additions
and
17 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,4 +1,3 @@ | ||
[run] | ||
omit = | ||
planetarium/downward.py | ||
planetarium/evaluate.py | ||
planetarium/downward.py |
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,59 @@ | ||
from itertools import product | ||
|
||
from planetarium import evaluate | ||
|
||
from .test_oracle import ( | ||
blocksworld_underspecified, | ||
blocksworld_missing_clears, | ||
blocksworld_missing_ontables, | ||
blocksworld_fully_specified, | ||
) | ||
|
||
|
||
class TestEvaluate: | ||
""" | ||
Test suite for the evaluation of PDDL problem descriptions. | ||
""" | ||
|
||
def test_evaluate_equivalent( | ||
self, | ||
subtests, | ||
blocksworld_missing_clears, | ||
blocksworld_fully_specified, | ||
blocksworld_missing_ontables, | ||
): | ||
""" | ||
Test if the evaluation of PDDL problem descriptions is correct. | ||
""" | ||
descs = [ | ||
("blocksworld_missing_clears", blocksworld_missing_clears), | ||
("blocksworld_fully_specified", blocksworld_fully_specified), | ||
("blocksworld_missing_ontables", blocksworld_missing_ontables), | ||
] | ||
for (name1, desc1), (name2, desc2) in product(descs, descs): | ||
with subtests.test(f"{name1} equals {name2}"): | ||
assert all(evaluate.evaluate(desc1, desc2)) | ||
|
||
def test_evaluate_inequivalent( | ||
self, | ||
subtests, | ||
blocksworld_missing_clears, | ||
blocksworld_fully_specified, | ||
blocksworld_missing_ontables, | ||
blocksworld_underspecified, | ||
): | ||
""" | ||
Test if the evaluation of PDDL problem descriptions is correct. | ||
""" | ||
descs = [ | ||
("blocksworld_missing_clears", blocksworld_missing_clears), | ||
("blocksworld_fully_specified", blocksworld_fully_specified), | ||
("blocksworld_missing_ontables", blocksworld_missing_ontables), | ||
] | ||
for name1, desc1 in descs: | ||
with subtests.test(f"{name1} not equals blocksworld_underspecified"): | ||
assert evaluate.evaluate(desc1, blocksworld_underspecified) == ( | ||
True, | ||
True, | ||
False, | ||
) |