From 5dff0d6e9aad21de4ba200614f27687b3b667cda Mon Sep 17 00:00:00 2001 From: Mike Lin Date: Sun, 16 Jun 2024 19:02:44 -1000 Subject: [PATCH] fix tests --- WDL/Tree.py | 2 +- tests/test_1doc.py | 26 +++++++++++++------------- tests/test_4taskrun.py | 2 +- tests/test_5stdlib.py | 4 ++-- tests/test_6workflowrun.py | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/WDL/Tree.py b/WDL/Tree.py index 90388be6..006df06f 100644 --- a/WDL/Tree.py +++ b/WDL/Tree.py @@ -1128,7 +1128,7 @@ def typecheck(self, doc: "Document", check_quant: bool) -> None: # conditional section therein stdlib = StdLib.Base(self.effective_wdl_version) _build_workflow_type_env(doc, stdlib, check_quant) - assert self._type_env + assert self._type_env is not None with Error.multi_context() as errors: # 3. typecheck the right-hand side expressions of each declaration # and the inputs to each call (descending into scatter & conditional diff --git a/tests/test_1doc.py b/tests/test_1doc.py index ca6bb0e0..44463e59 100644 --- a/tests/test_1doc.py +++ b/tests/test_1doc.py @@ -53,7 +53,7 @@ def test_wc(self): } """] for task_str in variants: - task = WDL.parse_tasks(task_str)[0] + task = WDL.parse_tasks(task_str, "1.0")[0] self.assertEqual(len(task.inputs), 1) self.assertEqual(str(task.inputs[0]), "String in") @@ -92,7 +92,7 @@ def test_errors(self): String in } command { - echo "~{bogus}" | wc + echo "${bogus}" | wc } } """)[0].typecheck() @@ -109,7 +109,7 @@ def test_errors(self): String ans = "${bogus}" } } - """)[0].typecheck() + """, "1.0")[0].typecheck() with self.assertRaises(WDL.Error.MultipleValidationErrors): WDL.parse_tasks(""" task wc { @@ -124,7 +124,7 @@ def test_errors(self): output { } } - """)[0].typecheck() + """, "1.0")[0].typecheck() def test_placeholders(self): task = WDL.parse_tasks(""" @@ -136,7 +136,7 @@ def test_placeholders(self): echo "~{true='yes' false='no' b}" >>> } - """)[0] + """, "1.0")[0] task.typecheck() stdlib = WDL.StdLib.Base("1.0") self.assertEqual(task.command.parts[1].eval(WDL.Env.Bindings().bind('b', WDL.Value.Boolean(True)), stdlib).value, 'yes') @@ -170,7 +170,7 @@ def test_placeholders(self): echo "~{true='yes' false='no' b}" } } - """)[0].typecheck() + """, "1.0")[0].typecheck() with self.assertRaises(WDL.Error.StaticTypeMismatch): WDL.parse_tasks(""" @@ -179,7 +179,7 @@ def test_placeholders(self): echo "~{true='yes' false='no' 42}" } } - """)[0].typecheck() + """, "1.0")[0].typecheck() with self.assertRaises(WDL.Error.StaticTypeMismatch): WDL.parse_tasks(""" @@ -191,7 +191,7 @@ def test_placeholders(self): echo "~{false='no' b}" } } - """)[0].typecheck() + """, "1.0")[0].typecheck() task = WDL.parse_tasks(""" task wc { @@ -202,7 +202,7 @@ def test_placeholders(self): echo "~{sep=', ' s} baz" >>> } - """)[0] + """, "1.0")[0] task.typecheck() foobar = WDL.Value.Array(WDL.Type.String(), [WDL.Value.String("foo"), WDL.Value.String("bar")]) self.assertEqual(task.command.parts[1].eval(WDL.Env.Bindings().bind('s', foobar), stdlib).value, 'foo, bar') @@ -218,7 +218,7 @@ def test_placeholders(self): echo "~{s} baz" >>> } - """)[0].typecheck() + """, "1.0")[0].typecheck() with self.assertRaises(WDL.Error.StaticTypeMismatch): WDL.parse_tasks(""" task wc { @@ -229,7 +229,7 @@ def test_placeholders(self): echo "~{sep=', ' s} baz" >>> } - """)[0].typecheck() + """, "1.0")[0].typecheck() task = WDL.parse_tasks(""" task wc { @@ -325,7 +325,7 @@ def test_meta(self): meta_key: 321 } } - """)[0] + """, "1.0")[0] task.typecheck() self.assertIsInstance(task.parameter_meta['b']['help'], str) self.assertEqual(task.parameter_meta['b']['help'], "it's a boolean") @@ -360,7 +360,7 @@ def test_meta(self): cpu: 42 } } - """)[0] + """, "1.0")[0] task.typecheck() self.assertIsInstance(task.meta['description'], str) self.assertEqual(task.meta['description'], "it's a task") diff --git a/tests/test_4taskrun.py b/tests/test_4taskrun.py index 23c8c7a8..163fbe5d 100644 --- a/tests/test_4taskrun.py +++ b/tests/test_4taskrun.py @@ -1198,7 +1198,7 @@ def test_mount_tmpdir(self): cfg = WDL.runtime.config.Loader(logging.getLogger(self.id()), []) cfg.override({"file_io": {"mount_tmpdir_for": ["xyz"]}}) outputs = self._test_task(txt, cfg=cfg) - self.assertEquals(outputs["tmpdir"], "") + self.assertEqual(outputs["tmpdir"], "") outputs = self._test_task(txt.replace("XXX", "xyz"), cfg=cfg) self.assertTrue(outputs["tmpdir"].startswith("/mnt/miniwdl")) diff --git a/tests/test_5stdlib.py b/tests/test_5stdlib.py index b7f27390..4088c62e 100644 --- a/tests/test_5stdlib.py +++ b/tests/test_5stdlib.py @@ -1035,7 +1035,7 @@ def test_issue538(self): } } """) - self.assertEquals(outp["result"], {"map": {"foo":"bar", "fizz":"buzz"}}) + self.assertEqual(outp["result"], {"map": {"foo":"bar", "fizz":"buzz"}}) def test_issue563(self): # still more struct init regression @@ -1055,7 +1055,7 @@ def test_issue563(self): } } """, {"j": {"x": 0}}) - self.assertEquals(outp, {"out": [{"x": 0}]}) + self.assertEqual(outp, {"out": [{"x": 0}]}) def test_issue580(self): # error in nested struct diff --git a/tests/test_6workflowrun.py b/tests/test_6workflowrun.py index 571e3d71..aeb81fc4 100644 --- a/tests/test_6workflowrun.py +++ b/tests/test_6workflowrun.py @@ -1128,7 +1128,7 @@ def test_retry(self): self.assertFalse(outputs["stdout_txt"].endswith("stdout.txt")) with open(outputs["stdout_txt"]) as stdout_txt: stdout_lines = stdout_txt.read().strip().split("\n") - self.assertEquals(len(stdout_lines), 1) + self.assertEqual(len(stdout_lines), 1) cfg = WDL.runtime.config.Loader(logging.getLogger(self.id()), []) cfg.override({"file_io": {"delete_work": "failure"}, "task_runtime": {"_mock_interruptions": 2}}) outputs = self._test_workflow(txt, cfg=cfg)