Skip to content

Commit 5436db1

Browse files
authored
Merge pull request #84 from lab-v2/fix-tests
add fixtures for new head_functions arg
2 parents 031398c + 033af4e commit 5436db1

5 files changed

Lines changed: 11 additions & 3 deletions

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
__pycache__/
33
*.py[cod]
44
*$py.class
5-
"pyreason/.cache_status.yaml
5+
pyreason/.cache_status.yaml
66
# Cache status file when initialized
77
# Keep the initial false version in repo, ignore when it becomes true
88
.DS_STORE

tests/unit/disable_jit/interpretations/test_ground_rule_helpers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -919,6 +919,8 @@ def get_clauses(self): return self._clauses
919919
def get_thresholds(self): return self._thresholds
920920
def get_annotation_function(self): return self._ann_fn
921921
def get_edges(self): return self._rule_edges
922+
def get_head_function(self): return ["", ""]
923+
def get_head_function_vars(self): return [[], []]
922924

923925
def _shim_typed_list(monkeypatch):
924926
class _ListShim:

tests/unit/disable_jit/interpretations/test_interpretation_common.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,11 @@ def add_edge(*args):
7171
_ground_rule_fn = _py(interpretation._ground_rule)
7272
if "num_ga" in inspect.signature(_ground_rule_fn).parameters:
7373
def ground_rule(*args, **kwargs):
74+
kwargs.setdefault('head_functions', ())
7475
return _ground_rule_fn(*args, num_ga=[0], **kwargs)
7576
else:
7677
def ground_rule(*args, **kwargs):
78+
kwargs.setdefault('head_functions', ())
7779
return _ground_rule_fn(*args, **kwargs)
7880
ns.ground_rule = ground_rule
7981
ns.update_rule_trace = _py(interpretation._update_rule_trace)

tests/unit/disable_jit/interpretations/test_interpretation_init.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,9 @@ def test_interpretation_init_neighbors(shim_types):
7676
False,
7777
False,
7878
False,
79-
0,
8079
False,
80+
"",
81+
True,
8182
)
8283
assert set(interp.neighbors["n1"]) == {"n2"}
8384
assert set(interp.neighbors["n2"]) == {"n1"}
@@ -211,8 +212,9 @@ def build_interp():
211212
False,
212213
False,
213214
False,
214-
0,
215215
False,
216+
"",
217+
True,
216218
)
217219
interp.time = 5
218220
interp.prev_reasoning_data = [2, 0]

tests/unit/disable_jit/interpretations/test_reason_core.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ def is_static(self):
174174
"allow_ground_rules": True,
175175
"max_facts_time": 0,
176176
"annotation_functions": {},
177+
"head_functions": (),
177178
"convergence_mode": "perfect_convergence",
178179
"convergence_delta": 0,
179180
"verbose": False,
@@ -220,6 +221,7 @@ def run(**overrides):
220221
params["allow_ground_rules"],
221222
params["max_facts_time"],
222223
params["annotation_functions"],
224+
params["head_functions"],
223225
params["convergence_mode"],
224226
params["convergence_delta"],
225227
params["verbose"],

0 commit comments

Comments
 (0)