diff --git a/Dockerfile b/Dockerfile index 82919311..38e80090 100644 --- a/Dockerfile +++ b/Dockerfile @@ -475,6 +475,7 @@ RUN pip install flashtext && \ # b/149905611 The geopandas tests are broken with the version 0.7.0 pip install geopandas==0.6.3 && \ pip install nnabla && \ + conda install -c potassco clingo -y && \ /tmp/clean-layer.sh # Tesseract and some associated utility packages diff --git a/tests/test_clingo.py b/tests/test_clingo.py new file mode 100644 index 00000000..c80728bb --- /dev/null +++ b/tests/test_clingo.py @@ -0,0 +1,20 @@ +import unittest + +from clingo import Control + +class TestClingo(unittest.TestCase): + def test_solve(self): + cc = Control() + + cc.add('base', [], ''' + a(X) :- not b(X), d(X). + b(X) :- not a(X), d(X).''') + cc.add('base', [], "d(1;2;3).") + cc.ground([("base",[])]) + + out = {} + def onmodel(m): + out['out'] = str(m) + cc.solve(on_model = onmodel) + + self.assertEqual('d(1) d(2) d(3) b(1) b(2) b(3)', out['out'])