Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ca893d7

Browse files
lucasmouranorvig
authored andcommitted
Fix __call__ command for Graph class (aimacode#306)
1 parent ee5068e commit ca893d7

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

planning.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,8 @@ def __init__(self, pdll, negkb):
405405
self.levels = [Level(pdll.kb, negkb)]
406406
self.objects = set(arg for clause in pdll.kb.clauses + negkb.clauses for arg in clause.args)
407407

408-
def __call__():
409-
expand_graph()
408+
def __call__(self):
409+
self.expand_graph()
410410

411411
def expand_graph(self):
412412
last_level = self.levels[-1]

tests/test_planning.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,13 @@ def test_have_cake_and_eat_cake_too():
6969
p.act(action)
7070

7171
assert p.goal_test()
72+
73+
def test_graph_call():
74+
pdll = spare_tire()
75+
negkb = FolKB([expr('At(Flat, Trunk)')])
76+
graph = Graph(pdll, negkb)
77+
78+
levels_size = len(graph.levels)
79+
graph()
80+
81+
assert levels_size == len(graph.levels) - 1

0 commit comments

Comments
 (0)