Debian Codegraph @

tests/spec/unit/regression/github_912.py

raw
1 from pathlib import Path
2 from minizinc import default_driver, Driver
3 import subprocess
4 import json
5
6
7 def test_github_912():
8 here = Path(__file__).resolve().parent
9 assert isinstance(default_driver, Driver)
10 model_file = here / "github_912.mzn"
11 p = subprocess.run(
12 [default_driver._executable, model_file, "--json-stream"],
13 stdin=None,
14 stdout=subprocess.PIPE,
15 stderr=subprocess.PIPE,
16 )
17 assert p.returncode == 1
18 messages = [json.loads(l) for l in p.stdout.splitlines(False)]
19 errors = [m for m in messages if m["type"] == "error"]
20 assert len(errors) == 1
21 entries = [s for s in errors[0]["stack"] if s["isCompIter"]]
22 assert len(entries) == 1
23 assert entries[0]["description"] == "x = A"