FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix __call__ command for Graph class by lucasmoura · Pull Request #306 · aimacode/aima-python · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
4 changes: 2 additions & 2 deletions planning.py
This file contains hidden or 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
Expand Up @@ -405,8 +405,8 @@ def __init__(self, pdll, negkb):
self.levels = [Level(pdll.kb, negkb)]
self.objects = set(arg for clause in pdll.kb.clauses + negkb.clauses for arg in clause.args)

def __call__():
expand_graph()
def __call__(self):
self.expand_graph()

def expand_graph(self):
last_level = self.levels[-1]
Expand Down
10 changes: 10 additions & 0 deletions tests/test_planning.py
This file contains hidden or 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
Expand Up @@ -69,3 +69,13 @@ def test_have_cake_and_eat_cake_too():
p.act(action)

assert p.goal_test()

def test_graph_call():
pdll = spare_tire()
negkb = FolKB([expr('At(Flat, Trunk)')])
graph = Graph(pdll, negkb)

levels_size = len(graph.levels)
graph()

assert levels_size == len(graph.levels) - 1

Back | FazBrowse Home | New Git URL