Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mlin committed Jun 17, 2024
1 parent 2448409 commit 5dff0d6
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion WDL/Tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 13 additions & 13 deletions tests/test_1doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -92,7 +92,7 @@ def test_errors(self):
String in
}
command {
echo "~{bogus}" | wc
echo "${bogus}" | wc
}
}
""")[0].typecheck()
Expand All @@ -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 {
Expand All @@ -124,7 +124,7 @@ def test_errors(self):
output {
}
}
""")[0].typecheck()
""", "1.0")[0].typecheck()

def test_placeholders(self):
task = WDL.parse_tasks("""
Expand All @@ -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')
Expand Down Expand Up @@ -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("""
Expand All @@ -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("""
Expand All @@ -191,7 +191,7 @@ def test_placeholders(self):
echo "~{false='no' b}"
}
}
""")[0].typecheck()
""", "1.0")[0].typecheck()

task = WDL.parse_tasks("""
task wc {
Expand All @@ -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')
Expand All @@ -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 {
Expand All @@ -229,7 +229,7 @@ def test_placeholders(self):
echo "~{sep=', ' s} baz"
>>>
}
""")[0].typecheck()
""", "1.0")[0].typecheck()

task = WDL.parse_tasks("""
task wc {
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_4taskrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))

Expand Down
4 changes: 2 additions & 2 deletions tests/test_5stdlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_6workflowrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5dff0d6

Please sign in to comment.