-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #109 from egraphs-good/change
ChangeFix module handling and rephrase
- Loading branch information
Showing
4 changed files
with
52 additions
and
165 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import pytest | ||
# from egglog.declarations import ModuleDeclarations | ||
from egglog.egraph import * | ||
# from egglog.egraph import _BUILTIN_DECLS, BUILTINS | ||
|
||
|
||
def test_tree_modules(): | ||
""" | ||
BUILTINS | ||
/ | \ | ||
A B C | ||
| / | ||
D | ||
""" | ||
# assert _BUILTIN_DECLS | ||
# assert BUILTINS._mod_decls == ModuleDeclarations(_BUILTIN_DECLS, []) | ||
|
||
A, B, C = Module(), Module(), Module() | ||
# assert list(A._mod_decls._included_decls) == [_BUILTIN_DECLS] | ||
|
||
a = A.relation("a") | ||
b = B.relation("b") | ||
c = C.relation("c") | ||
A.register(a()) | ||
B.register(b()) | ||
C.register(c()) | ||
|
||
D = Module([A, B]) | ||
d = D.relation("d") | ||
D.register(d()) | ||
|
||
assert D._flatted_deps == [A, B] | ||
|
||
egraph = EGraph([D, B]) | ||
# assert egraph._flatted_deps == [A, B, D] | ||
egraph.check(a(), b(), d()) | ||
with pytest.raises(Exception): | ||
egraph.check(c()) |