|
12 | 12 | # See the License for the specific language governing permissions and |
13 | 13 | # limitations under the License. |
14 | 14 | import unittest |
| 15 | +from dataclasses import asdict |
15 | 16 |
|
16 | 17 | from dash import dash_table |
17 | 18 | from numpy import asarray |
@@ -47,14 +48,14 @@ def test_initial_sched(self): |
47 | 48 |
|
48 | 49 | # Check that CQM created has the right number of variables |
49 | 50 | def test_cqm(self): |
50 | | - cqm = employee_scheduling.build_cqm(self.test_params) |
| 51 | + cqm = employee_scheduling.build_cqm(**asdict(self.test_params)) |
51 | 52 |
|
52 | 53 | self.assertEqual(len(cqm.variables), |
53 | 54 | self.num_employees * len(self.shifts)) |
54 | 55 |
|
55 | 56 | # Check that NL assignments variable is the correct shape |
56 | 57 | def test_nl(self): |
57 | | - _, assignments = employee_scheduling.build_nl(self.test_params) |
| 58 | + _, assignments = employee_scheduling.build_nl(**asdict(self.test_params)) |
58 | 59 |
|
59 | 60 | self.assertEqual(assignments.shape(), |
60 | 61 | (self.num_employees, len(self.shifts))) |
@@ -84,7 +85,7 @@ def test_samples_cqm(self): |
84 | 85 | max_consecutive_shifts=6 |
85 | 86 | ) |
86 | 87 |
|
87 | | - cqm = employee_scheduling.build_cqm(test_params) |
| 88 | + cqm = employee_scheduling.build_cqm(**asdict(test_params)) |
88 | 89 |
|
89 | 90 | feasible_sample = { |
90 | 91 | "A-Mgr_1": 0.0, |
@@ -180,7 +181,7 @@ def test_states_nl(self): |
180 | 181 | max_consecutive_shifts=6 |
181 | 182 | ) |
182 | 183 |
|
183 | | - model, assignments = employee_scheduling.build_nl(test_params) |
| 184 | + model, assignments = employee_scheduling.build_nl(**asdict(test_params)) |
184 | 185 |
|
185 | 186 | if not model.is_locked(): |
186 | 187 | model.lock() |
|
0 commit comments