From 83a5a238ec41bebfd9638c8935ab76c88fa1b081 Mon Sep 17 00:00:00 2001 From: Lucas Moura Date: Fri, 3 Mar 2017 11:11:02 -0300 Subject: [PATCH] Fix __call__ command for Graph class --- planning.py | 4 ++-- tests/test_planning.py | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/planning.py b/planning.py index 4bfa1d71a..a17677460 100644 --- a/planning.py +++ b/planning.py @@ -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] diff --git a/tests/test_planning.py b/tests/test_planning.py index 3567ab445..4e012b207 100644 --- a/tests/test_planning.py +++ b/tests/test_planning.py @@ -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