From f3e4db6e19c5ed9c689831ceace76dfcd2b7d568 Mon Sep 17 00:00:00 2001 From: Paul Madden Date: Mon, 24 Jun 2024 16:34:47 +0000 Subject: [PATCH] Parametrize for loops --- src/uwtools/tests/drivers/test_driver.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/uwtools/tests/drivers/test_driver.py b/src/uwtools/tests/drivers/test_driver.py index 8f3914ff8..91397b53a 100644 --- a/src/uwtools/tests/drivers/test_driver.py +++ b/src/uwtools/tests/drivers/test_driver.py @@ -258,13 +258,15 @@ def test_Driver_run(batch, driverobj): rvle.assert_called_once_with() -def test_Driver_runscript(driverobj): +@mark.parametrize( + "arg_type", [("envcmds", list), ("envvars", dict), ("execution", list), ("scheduler", Slurm)] +) +def test_Driver_runscript(arg_type, driverobj): + arg, type_ = arg_type with patch.object(driverobj, "_runscript") as runscript: driverobj.runscript() runscript.assert_called_once() - args = ("envcmds", "envvars", "execution", "scheduler") - types = [list, dict, list, Slurm] - assert [type(runscript.call_args.kwargs[x]) for x in args] == types + assert isinstance(runscript.call_args.kwargs[arg], type_) def test_Driver__run_via_batch_submission(driverobj):