Skip to content

Commit

Permalink
fix wf
Browse files Browse the repository at this point in the history
  • Loading branch information
TieuLongPhan committed Jul 11, 2024
1 parent f373489 commit 599c145
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 67 deletions.
40 changes: 0 additions & 40 deletions .github/worflows/test-and-lint.yml

This file was deleted.

8 changes: 1 addition & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,9 @@
*.gml
.pytest_cache
__pycache__
mod_test.py
clean_code.ipynb
*pdf
test.py
test_database_out.json.gz
test_database.json.gz
Data/uspto/*

aam_reactions.json.gz

*.tar.gz
*pkl.gz
*json.gz
Expand Down
Binary file added Data/Testcase/its_graph.pkl.gz
Binary file not shown.
Binary file added Data/Testcase/templates.pkl.gz
Binary file not shown.
41 changes: 21 additions & 20 deletions Test/SynRule/test_rule_writing.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class TestRuleWriting(unittest.TestCase):

def setUp(self) -> None:
self.data = load_from_pickle("Data/Testcase/templates.pkl.gz")
self.data = load_from_pickle("Data/Testcase/templates.pkl.gz")[0]

def test_charge_to_string(self):
self.assertEqual(RuleWriting.charge_to_string(3), "+++")
Expand Down Expand Up @@ -47,18 +47,18 @@ def test_rules_grammar(self):
"rule [\n"
' ruleID "test_rule"\n'
" left [\n"
' edge [ source 4 target 21 label "-" ]\n'
' edge [ source 21 target 4 label "-" ]\n'
' edge [ source 3 target 20 label "-" ]\n'
" ]\n"
" context [\n"
' node [ id 4 label "N" ]\n'
' node [ id 21 label "H" ]\n'
' node [ id 3 label "C" ]\n'
' node [ id 4 label "N" ]\n'
' node [ id 20 label "Br" ]\n'
' node [ id 21 label "H" ]\n'
" ]\n"
" right [\n"
' edge [ source 4 target 3 label "-" ]\n'
' edge [ source 20 target 21 label "-" ]\n'
' edge [ source 21 target 20 label "-" ]\n'
' edge [ source 3 target 4 label "-" ]\n'
" ]\n"
"]"
)
Expand All @@ -78,22 +78,23 @@ def test_process_graph_rules(self):
K = self.data[0]["RC"][2]
graph_rules = {"R-id": "test_rule", "GraphRules": (L, R, K)}
gml_str = RuleWriting.process_graph_rules(graph_rules, reindex=True)
print(gml_str)
expected_str = (
"rule [\n"
' ruleID "test_rule"\n'
" left [\n"
' edge [ source 1 target 4 label "-" ]\n'
' edge [ source 2 target 3 label "-" ]\n'
' edge [ source 1 target 3 label "-" ]\n'
' edge [ source 2 target 4 label "-" ]\n'
" ]\n"
" context [\n"
' node [ id 1 label "N" ]\n'
' node [ id 1 label "H" ]\n'
' node [ id 2 label "C" ]\n'
' node [ id 3 label "Br" ]\n'
' node [ id 4 label "H" ]\n'
' node [ id 3 label "N" ]\n'
' node [ id 4 label "Br" ]\n'
" ]\n"
" right [\n"
' edge [ source 1 target 2 label "-" ]\n'
' edge [ source 3 target 4 label "-" ]\n'
' edge [ source 1 target 4 label "-" ]\n'
' edge [ source 2 target 3 label "-" ]\n'
" ]\n"
"]"
)
Expand All @@ -107,18 +108,18 @@ def test_auto_extraction(self):
"rule [\n"
' ruleID "0"\n'
" left [\n"
' edge [ source 1 target 4 label "-" ]\n'
' edge [ source 2 target 3 label "-" ]\n'
' edge [ source 1 target 3 label "-" ]\n'
' edge [ source 2 target 4 label "-" ]\n'
" ]\n"
" context [\n"
' node [ id 1 label "N" ]\n'
' node [ id 1 label "H" ]\n'
' node [ id 2 label "C" ]\n'
' node [ id 3 label "Br" ]\n'
' node [ id 4 label "H" ]\n'
' node [ id 3 label "N" ]\n'
' node [ id 4 label "Br" ]\n'
" ]\n"
" right [\n"
' edge [ source 1 target 2 label "-" ]\n'
' edge [ source 3 target 4 label "-" ]\n'
' edge [ source 1 target 4 label "-" ]\n'
' edge [ source 2 target 3 label "-" ]\n'
" ]\n"
"]"
)
Expand Down

0 comments on commit 599c145

Please sign in to comment.