6
6
import pytest
7
7
from support import InstanceTestCase
8
8
9
- from minizinc import Instance
9
+ from minizinc import Instance , default_driver
10
10
from minizinc .result import Status
11
11
from minizinc .types import AnonEnum , ConstrEnum
12
12
@@ -105,6 +105,10 @@ def test_intenum_collections(self):
105
105
# TODO: assert result["arr_t"] == [TT(3), TT(2), TT(1)]
106
106
assert result ["set_t" ] == {TT (1 ), TT (2 )}
107
107
108
+ @pytest .mark .skipif (
109
+ default_driver is None or default_driver .parsed_version < (2 , 6 , 0 ),
110
+ reason = "requires MiniZinc 2.6 or higher" ,
111
+ )
108
112
def test_constructor_enum (self ):
109
113
self .instance = Instance (self .solver )
110
114
self .instance .add_string (
@@ -121,6 +125,10 @@ def test_constructor_enum(self):
121
125
assert result ["x" ] == ConstrEnum ("X" , 2 )
122
126
assert str (result ["x" ]) == "X(2)"
123
127
128
+ @pytest .mark .skipif (
129
+ default_driver is None or default_driver .parsed_version < (2 , 6 , 0 ),
130
+ reason = "requires MiniZinc 2.6 or higher" ,
131
+ )
124
132
def test_anon_enum (self ):
125
133
self .instance = Instance (self .solver )
126
134
self .instance .add_string (
@@ -183,6 +191,10 @@ def test_string(self):
183
191
184
192
185
193
class TestTuple (InstanceTestCase ):
194
+ @pytest .mark .skipif (
195
+ default_driver is None or default_driver .parsed_version < (2 , 7 , 0 ),
196
+ reason = "requires MiniZinc 2.7 or higher" ,
197
+ )
186
198
def test_simple_tuple (self ):
187
199
self .instance .add_string (
188
200
"""
@@ -199,6 +211,10 @@ def test_simple_tuple(self):
199
211
assert isinstance (tup [2 ], float )
200
212
assert 1.0 <= tup [2 ] and tup [2 ] <= 3.0
201
213
214
+ @pytest .mark .skipif (
215
+ default_driver is None or default_driver .parsed_version < (2 , 7 , 0 ),
216
+ reason = "requires MiniZinc 2.7 or higher" ,
217
+ )
202
218
def test_rec_tuple (self ):
203
219
self .instance .add_string (
204
220
"""
@@ -221,7 +237,12 @@ def test_rec_tuple(self):
221
237
222
238
223
239
class TestRecord (InstanceTestCase ):
240
+ @pytest .mark .skipif (
241
+ default_driver is None or default_driver .parsed_version < (2 , 7 , 0 ),
242
+ reason = "requires MiniZinc 2.7 or higher" ,
243
+ )
224
244
def test_simple_record (self ):
245
+ pytest .skip
225
246
self .instance .add_string (
226
247
"""
227
248
var record(1..3: a, bool: b, 1.0..3.0: c): x;
@@ -237,6 +258,10 @@ def test_simple_record(self):
237
258
assert isinstance (rec ["c" ], float )
238
259
assert 1.0 <= rec ["c" ] and rec ["c" ] <= 3.0
239
260
261
+ @pytest .mark .skipif (
262
+ default_driver is None or default_driver .parsed_version < (2 , 7 , 0 ),
263
+ reason = "requires MiniZinc 2.7 or higher" ,
264
+ )
240
265
def test_rec_record (self ):
241
266
self .instance .add_string (
242
267
"""
@@ -345,12 +370,20 @@ def test_npint64(self):
345
370
346
371
347
372
class TestAnn (InstanceTestCase ):
373
+ @pytest .mark .skipif (
374
+ default_driver is None or default_driver .parsed_version < (2 , 6 , 0 ),
375
+ reason = "requires MiniZinc 2.6 or higher" ,
376
+ )
348
377
def test_ann_atom (self ):
349
378
self .instance .add_string ("ann: x :: add_to_output = promise_total;" )
350
379
result = self .instance .solve ()
351
380
assert result .status is Status .SATISFIED
352
381
assert result ["x" ] == "promise_total"
353
382
383
+ @pytest .mark .skipif (
384
+ default_driver is None or default_driver .parsed_version < (2 , 6 , 0 ),
385
+ reason = "requires MiniZinc 2.6 or higher" ,
386
+ )
354
387
def test_ann_call (self ):
355
388
self .instance .add_string ('ann: x :: add_to_output = expression_name("test");' )
356
389
result = self .instance .solve ()
0 commit comments