File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,6 +9,14 @@ this project adheres to `Semantic Versioning <https://semver.org/>`_.
99Unreleased _
1010------------
1111
12+ 0.3.2 _ - 2020-08-14
13+ -------------------
14+
15+ Fixed
16+ ^^^^^
17+ - Add full support for string input and output. The usage of strings would
18+ previously incorrectly give a warning.
19+
12200.3.1 _ - 2020-07-21
1321-------------------
1422
Original file line number Diff line number Diff line change @@ -41,6 +41,8 @@ def to_python_type(mzn_type: dict) -> Type:
4141 pytype = float
4242 elif basetype == "int" :
4343 pytype = int
44+ elif basetype == "string" :
45+ pytype = str
4446 else :
4547 warnings .warn (
4648 f"Unable to determine minizinc type `{ basetype } ` assuming integer type" ,
Original file line number Diff line number Diff line change @@ -82,3 +82,18 @@ def test_ranges(self):
8282 result = self .instance .solve ()
8383 assert isinstance (result ["s" ], range )
8484 assert result ["s" ] == range (1 , 4 )
85+
86+
87+ class TestString (InstanceTestCase ):
88+ code = """
89+ array[int] of string: names;
90+ var index_set(names): x;
91+ string: name ::output_only ::add_to_output = names[fix(x)];
92+ """
93+
94+ def test_string (self ):
95+ names = ["Guido" , "Peter" ]
96+ self .instance ["names" ] = names
97+
98+ result = self .instance .solve ()
99+ assert result .solution .name in names
You can’t perform that action at this time.
0 commit comments