Skip to content

Commit fc889c3

Browse files
committed
update tests to use asdict with ModelParams
1 parent 1a024bc commit fc889c3

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

tests/test_inputs.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
import unittest
15+
from dataclasses import asdict
1516

1617
from dash import dash_table
1718
from numpy import asarray
@@ -47,14 +48,14 @@ def test_initial_sched(self):
4748

4849
# Check that CQM created has the right number of variables
4950
def test_cqm(self):
50-
cqm = employee_scheduling.build_cqm(self.test_params)
51+
cqm = employee_scheduling.build_cqm(**asdict(self.test_params))
5152

5253
self.assertEqual(len(cqm.variables),
5354
self.num_employees * len(self.shifts))
5455

5556
# Check that NL assignments variable is the correct shape
5657
def test_nl(self):
57-
_, assignments = employee_scheduling.build_nl(self.test_params)
58+
_, assignments = employee_scheduling.build_nl(**asdict(self.test_params))
5859

5960
self.assertEqual(assignments.shape(),
6061
(self.num_employees, len(self.shifts)))
@@ -84,7 +85,7 @@ def test_samples_cqm(self):
8485
max_consecutive_shifts=6
8586
)
8687

87-
cqm = employee_scheduling.build_cqm(test_params)
88+
cqm = employee_scheduling.build_cqm(**asdict(test_params))
8889

8990
feasible_sample = {
9091
"A-Mgr_1": 0.0,
@@ -180,7 +181,7 @@ def test_states_nl(self):
180181
max_consecutive_shifts=6
181182
)
182183

183-
model, assignments = employee_scheduling.build_nl(test_params)
184+
model, assignments = employee_scheduling.build_nl(**asdict(test_params))
184185

185186
if not model.is_locked():
186187
model.lock()

0 commit comments

Comments
 (0)