From b43dd030cb6a149ab5c6ddfa709f4e061266d04d Mon Sep 17 00:00:00 2001 From: Jorge Fandinno Date: Mon, 8 Jun 2026 16:35:54 -0500 Subject: [PATCH 1/4] update GitHub action versions --- .github/workflows/test.yml | 8 +-- tests/build_programs.py | 14 ++--- tests/helper_build_programs.py | 2 +- tests/test_eclingo.py | 90 ++++++++++------------------- tests/test_generator_reification.py | 6 +- tests/test_solver_reification.py | 6 +- 6 files changed, 44 insertions(+), 82 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 89fd6b2..a5c5de9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,10 +16,10 @@ jobs: clingo-version: ['>=5.5.0,<5.6.0','>=5.6.0,<5.7.0','>=5.7.0,<5.8.0'] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v6 - name: Set up Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} cache: 'pip' @@ -30,7 +30,7 @@ jobs: python -m pip install clingox==1.2.1.post2 --extra-index-url https://test.pypi.org/simple/ python -m pip install nox python -m pip install isort - + - name: Clingo version id: clingo-version run: | @@ -38,7 +38,7 @@ jobs: - name: Cache nox id: cache-nox - uses: actions/cache@v3 + uses: actions/cache@v5 with: path: .nox key: ${{ runner.os }}-python-${{ matrix.python-version }}-clingo-${{ env.CLINGO_VERSION }}-nox diff --git a/tests/build_programs.py b/tests/build_programs.py index 0f78d53..2958d41 100644 --- a/tests/build_programs.py +++ b/tests/build_programs.py @@ -98,7 +98,7 @@ def _format(self, object, stream, indent, allowance, context, level): def build_preprocessor_result( - value: Union[str, tuple[str, str]] + value: Union[str, tuple[str, str]], ) -> Tuple[List[Symbol], List[Symbol]]: if isinstance(value, str): lower = upper = value @@ -161,8 +161,7 @@ def complete_program(program: programs.Program) -> programs_helper.Program: path = os.path.dirname(os.path.abspath(__file__)) path = os.path.join(path, "generated_programs.py") with open(path, "w") as f: - f.write( - f'''\ + f.write(f'''\ """ DO NO MODIFY THIS FILE MANUALLY! @@ -171,18 +170,15 @@ def complete_program(program: programs.Program) -> programs_helper.Program: """ -''' - ) - f.write( - f"""\ +''') + f.write(f"""\ from clingo import Function, Number from eclingo.solver.candidate import Candidate, Assumptions from tests.programs_helper import Program programs = [ {textwrap.indent(str_programs, 4*" ")} -]""" - ) +]""") # for program in programs: # program = complete_program(program) diff --git a/tests/helper_build_programs.py b/tests/helper_build_programs.py index 36854f6..b2dfbad 100644 --- a/tests/helper_build_programs.py +++ b/tests/helper_build_programs.py @@ -108,7 +108,7 @@ def build_assumptions(assumptions: str) -> Assumptions: def build_candidate( - candidate: Union[str, Tuple[str, str]] + candidate: Union[str, Tuple[str, str]], ) -> Optional[List[Candidate]]: if isinstance(candidate, str): return build_candidate_without_assumptions(candidate) diff --git a/tests/test_eclingo.py b/tests/test_eclingo.py index 23e1eeb..2bf7c73 100644 --- a/tests/test_eclingo.py +++ b/tests/test_eclingo.py @@ -66,57 +66,47 @@ def test_programs_with_default_negation(self): ) # this failed in eclingo self.assert_models(solve("b :- &k{ not not a }. c :- &k{ b }."), [[]]) self.assert_models( - solve( - """ + solve(""" a :- not c. c :- not a. b :- &k{ a }. :- b. - """ - ), + """), [[]], ) self.assert_models( - solve( - """ + solve(""" a :- not c. c :- not a. b :- &k{ not a }. :- b. - """ - ), + """), [["&m{a}"]], ) self.assert_models( - solve( - """ + solve(""" a :- not c. c :- not a. b :- not &k{ not a }. d :- &k{ b }. - """ - ), + """), [["&k{b}", "&m{a}"]], ) self.assert_models( - solve( - """ + solve(""" a, c. b :- not &k{ not a }. d :- &k{ b }. - """ - ), + """), [["&k{b}", "&m{a}"]], ) self.assert_models( - solve( - """ + solve(""" p, q. r :- p. r :- q. s :- &k{ r }. - """ - ), + """), [["&k{r}"]], ) @@ -164,65 +154,55 @@ def test_programs_with_default_negation(self): solve("b :- &k{ not not a(X) }, dom(X). dom(1..2). c :- &k{ b }."), [[]] ) self.assert_models( - solve( - """ + solve(""" a(1) :- not c(1). c(1) :- not a(1). b(X) :- &k{ a(X) }, dom(X). :- b(X), dom(X). dom(1..2). - """ - ), + """), [[]], ) self.assert_models( - solve( - """ + solve(""" a(1) :- not c(1). c(1) :- not a(1). b(X) :- &k{ not a(X) }, dom(X). dom(1..2). :- b(1). :- not b(2). - """ - ), + """), [["&m{a(1)}"]], ) self.assert_models( - solve( - """ + solve(""" a(1) :- not c(1). c(1) :- not a(1). b(X) :- not &k{ not a(X) }, dom(X). dom(1..2). d(X) :- &k{ b(X) }. - """ - ), + """), [["&m{a(1)}", "&k{b(1)}"]], ) self.assert_models( - solve( - """ + solve(""" a(1), c(1). b(X) :- not &k{ not a(X) }, dom(X). dom(1..2). d(X) :- &k{ b(X) }. - """ - ), + """), [["&m{a(1)}", "&k{b(1)}"]], ) def test_grounding_simplifications(self): self.assert_models( - solve( - """ + solve(""" dom(1..2). :- &k{ a(X) }, not a(X), dom(X). a(1). {a(2)}. :- {a(2)} = 0. - """ - ), + """), [["&k{a(1)}", "&k{a(2)}"]], ) @@ -230,38 +210,32 @@ def test_grounding_simplifications(self): class TestEclingoAggregates(TestCase): def test_ground_programs(self): self.assert_models( - solve( - """ + solve(""" a. b :- a. c :- &k{b}. d :- &k{c}. - """ - ), + """), [["&k{b}", "&k{c}"]], ) self.assert_models( - solve( - """ + solve(""" a. b :- #count{a} >= 1. c :- &k{b}. d :- &k{c}. - """ - ), + """), [["&k{b}", "&k{c}"]], ) self.assert_models( - solve( - """ + solve(""" a :- not &k{ not a}. b :- a. c :- &k{b}. d :- &k{c}. - """ - ), + """), [[], ["&m{a}", "&k{b}", "&k{c}"]], ) @@ -325,24 +299,20 @@ def test_ground_programs(self): class TestEclingoUnfounded(TestCase): # pylint: disable=invalid-name def test_ground_programs(self): self.assert_models( - solve( - """ + solve(""" a, b. a :- &k{b}. b :- &k{a}. - """ - ), + """), [[], ["&k{a}", "&k{b}"]], ) self.assert_models( - solve( - """ + solve(""" {a}. b :- a. c :- not a. c :- &k{b}. b :- &k{c}. - """ - ), + """), [[], ["&k{b}", "&k{c}"]], ) diff --git a/tests/test_generator_reification.py b/tests/test_generator_reification.py index a4af5d1..0ce5c74 100644 --- a/tests/test_generator_reification.py +++ b/tests/test_generator_reification.py @@ -272,8 +272,7 @@ def test_generator_programs(self): def test_generator02_reification(self): # echo "-a. b :- &k{-a}. c :- &k{b}." | eclingo --semantics c19-1 --reification --output=reify self.assert_models( - generate( - """tag(incremental). + generate("""tag(incremental). atom_tuple(0). atom_tuple(0,1). literal_tuple(0). rule(disjunction(0),normal(0)). atom_tuple(1). atom_tuple(1,2). rule(choice(1),normal(0)). atom_tuple(2). atom_tuple(2,3). literal_tuple(1). @@ -283,8 +282,7 @@ def test_generator02_reification(self): rule(disjunction(4),normal(3)). output(k(u(-a)),1). output(k(u(b)),3). output(u(-a),0). output(u(b),2). literal_tuple(4). literal_tuple(4,5). output(u(c),4). rule(choice(1),normal(0)). rule(disjunction(2),normal(1)). rule(choice(3),normal(2)). - rule(disjunction(4),normal(3)).""" - ), + rule(disjunction(4),normal(3))."""), [ # Candidate(pos=[], neg=[Function('k', [Function('u', [Function('b', [], True)], True)], True), # Function('k', [Function('u', [Function('a', [], False)], True)], True)]), diff --git a/tests/test_solver_reification.py b/tests/test_solver_reification.py index 2c65630..9199f41 100644 --- a/tests/test_solver_reification.py +++ b/tests/test_solver_reification.py @@ -53,8 +53,7 @@ def test_solver_reification01(self): def test_solver_reification_explicit_negation(self): # echo "-a. b :- &k{-a}. c :- &k{b}." | eclingo --semantics c19-1 --reification self.assert_models( - solve( - """tag(incremental). + solve("""tag(incremental). atom_tuple(0). atom_tuple(0,1). literal_tuple(0). rule(disjunction(0),normal(0)). atom_tuple(1). atom_tuple(1,2). rule(choice(1),normal(0)). atom_tuple(2). atom_tuple(2,3). literal_tuple(1). @@ -64,8 +63,7 @@ def test_solver_reification_explicit_negation(self): rule(disjunction(4),normal(3)). output(k(u(-a)),1). output(k(u(b)),3). output(u(-a),0). output(u(b),2). literal_tuple(4). literal_tuple(4,5). output(u(c),4). rule(choice(1),normal(0)). rule(disjunction(2),normal(1)). rule(choice(3),normal(2)). - rule(disjunction(4),normal(3)).""" - ), + rule(disjunction(4),normal(3))."""), [ WorldView( [ From 2f21cc41ba3f388b1be4b83719f955c4295d75f5 Mon Sep 17 00:00:00 2001 From: Jorge Fandinno Date: Mon, 8 Jun 2026 16:41:20 -0500 Subject: [PATCH 2/4] update GitHub actions matrix --- .github/workflows/test.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a5c5de9..50240c5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,6 +14,13 @@ jobs: os: ['ubuntu-latest'] python-version: ['3.9', '3.11', '3.12'] clingo-version: ['>=5.5.0,<5.6.0','>=5.6.0,<5.7.0','>=5.7.0,<5.8.0'] + exclude: + - python-version: '3.11' + clingo-version: '>=5.5.0,<5.6.0' + - python-version: '3.12' + clingo-version: '>=5.6.0,<5.7.0' + - python-version: '3.12' + clingo-version: '>=5.7.0,<5.8.0' steps: - uses: actions/checkout@v6 From a397ddf8f35252c8cd847211e24ef008fd9c2567 Mon Sep 17 00:00:00 2001 From: Jorge Fandinno Date: Mon, 8 Jun 2026 16:42:08 -0500 Subject: [PATCH 3/4] update GitHub actions matrix --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 50240c5..6166a62 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,9 +18,9 @@ jobs: - python-version: '3.11' clingo-version: '>=5.5.0,<5.6.0' - python-version: '3.12' - clingo-version: '>=5.6.0,<5.7.0' + clingo-version: '>=5.5.0,<5.6.0' - python-version: '3.12' - clingo-version: '>=5.7.0,<5.8.0' + clingo-version: '>=5.6.0,<5.7.0' steps: - uses: actions/checkout@v6 From 526286f6c50aae40fcef066e732dbfdd32851726 Mon Sep 17 00:00:00 2001 From: Jorge Fandinno Date: Mon, 8 Jun 2026 16:43:57 -0500 Subject: [PATCH 4/4] update GitHub actions matrix --- .github/workflows/test.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6166a62..0487938 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,8 +12,8 @@ jobs: fail-fast: false matrix: os: ['ubuntu-latest'] - python-version: ['3.9', '3.11', '3.12'] - clingo-version: ['>=5.5.0,<5.6.0','>=5.6.0,<5.7.0','>=5.7.0,<5.8.0'] + python-version: ['3.9', '3.11', '3.12','3.14'] + clingo-version: ['>=5.5.0,<5.6.0','>=5.6.0,<5.7.0','>=5.7.0,<5.8.0', '>=5.8.0,<5.9.0'] exclude: - python-version: '3.11' clingo-version: '>=5.5.0,<5.6.0' @@ -21,6 +21,12 @@ jobs: clingo-version: '>=5.5.0,<5.6.0' - python-version: '3.12' clingo-version: '>=5.6.0,<5.7.0' + - python-version: '3.14' + clingo-version: '>=5.5.0,<5.6.0' + - python-version: '3.14' + clingo-version: '>=5.6.0,<5.7.0' + - python-version: '3.14' + clingo-version: '>=5.7.0,<5.8.0' steps: - uses: actions/checkout@v6