Skip to content

Commit 34339f4

Browse files
committed
add unit test to ensure persis_info being None gets set to empty dict inside function
1 parent b57d80c commit 34339f4

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

libensemble/tests/unit_tests/test_ufunc_runners.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,20 @@ def tupilize(arg1, arg2):
5454
simrunner.shutdown()
5555

5656

57+
def test_persis_info_from_none():
58+
calc_in, sim_specs, gen_specs = get_ufunc_args()
59+
60+
def tupilize(arg1, arg2):
61+
return (arg1, arg2)
62+
63+
sim_specs["sim_f"] = tupilize
64+
simrunner = Runner(sim_specs)
65+
libE_info = {"H_rows": np.array([2, 3, 4]), "workerID": 1, "comm": "fakecomm"}
66+
67+
result = simrunner.run(calc_in, {"libE_info": libE_info, "persis_info": None, "tag": 1})
68+
assert result == (calc_in, {})
69+
70+
5771
@pytest.mark.extra
5872
def test_globus_compute_runner_init():
5973
calc_in, sim_specs, gen_specs = get_ufunc_args()
@@ -122,6 +136,7 @@ def test_globus_compute_runner_fail():
122136
if __name__ == "__main__":
123137
test_normal_runners()
124138
test_thread_runners()
139+
test_persis_info_from_none()
125140
test_globus_compute_runner_init()
126141
test_globus_compute_runner_pass()
127142
test_globus_compute_runner_fail()

0 commit comments

Comments
 (0)