Skip to content

Commit 94234ee

Browse files
committed
Fix Incorrect Mock Assertion in TestEvaluators for Python 3.12
This commit resolves an AttributeError in the test_ipyparallel_evaluator method of the TestEvaluators class. The error was caused by the use of a non-existent method called_once() on a mock object. The correct method, assert_called_once(), has been applied to ensure the proper assertion of the mocked method's call frequency. This change ensures the test aligns with the intended functionality and adheres to the correct usage of the unittest.mock library in Python.
1 parent 19a1b4d commit 94234ee

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

test/test_em_framework/test_evaluators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def test_ipyparallel_evaluator(
7373

7474
with evaluators.IpyparallelEvaluator(model, client) as evaluator:
7575
evaluator.evaluate_experiments(10, 10, mocked_callback)
76-
lb_view.map.called_once()
76+
lb_view.map.assert_called_once()
7777

7878
# Check if mpi4py is installed and if we're on a Linux environment
7979
try:

0 commit comments

Comments
 (0)