From aef864f972445e8470282b2e56307a51a80c7321 Mon Sep 17 00:00:00 2001 From: Roland Kaminski Date: Tue, 26 Feb 2019 08:36:56 +0100 Subject: [PATCH] fix head &tel atoms --- telingo/tests/telingo_test.py | 2 ++ telingo/theory/head.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/telingo/tests/telingo_test.py b/telingo/tests/telingo_test.py index a680bae..616aa97 100644 --- a/telingo/tests/telingo_test.py +++ b/telingo/tests/telingo_test.py @@ -309,6 +309,8 @@ def test_head(self): , ['a(2)', 'c(0)', 'c(1)', 'c(2)'] ]) self.assertEqual(solve("&tel { a ;> b ;> c }.", always=False), [['a(0)', 'b(1)', 'c(2)']]) + self.assertEqual(solve("&tel { a(1) ;> b(2) ;> c(3) }.", always=False), [['a(1,0)', 'b(2,1)', 'c(3,2)']]) + self.assertEqual(solve("&tel { a(X) ;> b(X) ;> c(X) } :- X=(1;2).", always=False), [['a(1,0)', 'a(2,0)', 'b(1,1)', 'b(2,1)', 'c(1,2)', 'c(2,2)']]) self.assertEqual(solve("&tel { a ;>: b ;>: c }.", always=False, imin=3), [['a(0)'], ['a(0)', 'b(1)'], ['a(0)', 'b(1)', 'c(2)']]) self.assertEqual(solve("&tel { >* (&final | a) }. &tel { >* b }.", always=False, imin=3), [ ['a(0)', 'a(1)', 'b(0)', 'b(1)', 'b(2)'] diff --git a/telingo/theory/head.py b/telingo/theory/head.py index 427c67a..56a9b08 100644 --- a/telingo/theory/head.py +++ b/telingo/theory/head.py @@ -25,7 +25,7 @@ class FormulaToStr(_tf.Transformer): Converts head formuals to string. """ def visit_TelAtom(self, x): - args = "" if len(x.arguments) == 0 else "({})".format(",".join(map(self, x.arguments))) + args = "" if len(x.arguments) == 0 else "({})".format(",".join(map(str, x.arguments))) sign = "" if x.positive else "-" return "{}{}{}".format(sign, x.name, args)