diff --git a/lib/galaxy/tool_util/parser/yaml.py b/lib/galaxy/tool_util/parser/yaml.py
index 7ebc574c9ad..c3959984974 100644
--- a/lib/galaxy/tool_util/parser/yaml.py
+++ b/lib/galaxy/tool_util/parser/yaml.py
@@ -267,7 +267,7 @@ def _parse_test(i, test_dict) -> ToolSourceTest:
return test_dict
-def __to_test_assert_list(assertions) -> AssertionList:
+def to_test_assert_list(assertions) -> AssertionList:
def expand_dict_form(item):
key, value = item
new_value = value.copy()
@@ -281,6 +281,12 @@ def __to_test_assert_list(assertions) -> AssertionList:
for assertion in assertions:
# TODO: not handling nested assertions correctly,
# not sure these are used though.
+ if "that" not in assertion:
+ new_assertion = {}
+ for assertion_key, assertion_value in assertion.items():
+ new_assertion["that"] = assertion_key
+ new_assertion.update(assertion_value)
+ assertion = new_assertion
children = []
if "children" in assertion:
children = assertion["children"]
@@ -295,6 +301,9 @@ def __to_test_assert_list(assertions) -> AssertionList:
return assert_list or None # XML variant is None if no assertions made
+__to_test_assert_list = to_test_assert_list
+
+
class YamlPageSource(PageSource):
def __init__(self, inputs_list):
self.inputs_list = inputs_list
diff --git a/lib/galaxy/tool_util/xsd/galaxy.xsd b/lib/galaxy/tool_util/xsd/galaxy.xsd
index 4994e5e7b7e..02d67e1c35b 100644
--- a/lib/galaxy/tool_util/xsd/galaxy.xsd
+++ b/lib/galaxy/tool_util/xsd/galaxy.xsd
@@ -7322,24 +7322,39 @@ and ``contains``. In addition there is ``sim_size`` which is discouraged in favo
Documentation for PermissiveBoolean
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Number of bytes allowing for suffix (k|K|M|G|P|E)i?
-
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/unit/tool_util/test_test_parsing.py b/test/unit/tool_util/test_test_parsing.py
new file mode 100644
index 00000000000..c489d9658ca
--- /dev/null
+++ b/test/unit/tool_util/test_test_parsing.py
@@ -0,0 +1,40 @@
+import yaml
+
+from galaxy.tool_util.parser.yaml import to_test_assert_list
+
+# Legacy style
+ASSERT_THAT_LIST = yaml.safe_load(
+ """
+- that: "has_text"
+ text: "Number of input reads |\t1051466"
+- that: "has_text"
+ text: "Uniquely mapped reads number |\t871202"
+"""
+)
+# New list of assertion style
+ASSERT_LIST = yaml.safe_load(
+ """
+- has_text:
+ text: "Number of input reads |\t1051466"
+- has_text:
+ text: "Uniquely mapped reads number |\t871202"
+"""
+)
+# Singleton assertion
+SIMPLE_ASSERT = {"has_text": {"text": "Number of input reads |\t1051466"}}
+
+
+def test_assert_that_list_to_test_assert_list():
+ to_test_assert_list(ASSERT_THAT_LIST)
+
+
+def test_assert_list_to_test_assert_list():
+ to_test_assert_list(ASSERT_LIST)
+
+
+def test_simple_assert_to_test_assert_list():
+ to_test_assert_list(SIMPLE_ASSERT)
+
+
+def test_assert_legacy_same_as_new_list_style():
+ assert to_test_assert_list(ASSERT_THAT_LIST) == to_test_assert_list(ASSERT_THAT_LIST)