File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change 4646 the documentation.
4747- Correctly pass the ``-O0 `` flag to the CLI when ``optimisation_level `` is set
4848 to zero.
49+ - Set type of MiniZinc annotation output type `ann ` to `str ` in Python in
50+ accordance with the JSON output format.
4951
50520.4.2 _ - 2020-11-25
5153-------------------
Original file line number Diff line number Diff line change @@ -48,6 +48,8 @@ def to_python_type(mzn_type: dict) -> Type:
4848 pytype = int
4949 elif basetype == "string" :
5050 pytype = str
51+ elif basetype == "ann" :
52+ pytype = str
5153 else :
5254 warnings .warn (
5355 f"Unable to determine minizinc type `{ basetype } ` assuming integer type" ,
Original file line number Diff line number Diff line change @@ -220,3 +220,19 @@ def test_npint64(self):
220220 self .instance ["x" ] = numpy .int64 (0 )
221221 result = self .instance .solve ()
222222 assert result .status is Status .SATISFIED
223+
224+
225+ # Enable on MiniZinc 2.6+ (JSON output of annotations is broken before then)
226+ # class TestAnn(InstanceTestCase):
227+ # def test_ann_atom(self):
228+ # self.instance.add_string("ann: x :: add_to_output = promise_total;")
229+ # result = self.instance.solve()
230+ # assert result.status is Status.SATISFIED
231+ # assert result["x"] == "promise_total"
232+
233+ # def test_ann_call(self):
234+ # self.instance.add_string(
235+ # 'ann: x :: add_to_output = expression_name("test");')
236+ # result = self.instance.solve()
237+ # assert result.status is Status.SATISFIED
238+ # assert result["x"] == 'expression_name("test")'
You can’t perform that action at this time.
0 commit comments