|
12 | 12 |
|
13 | 13 | from galaxy.tool_util.lint import Linter |
14 | 14 | from galaxy.tool_util.parameters import validate_test_cases_for_tool_source |
15 | | -from galaxy.tool_util_models.assertions import assertion_list |
| 15 | +from galaxy.tool_util.verify.parse import tag_structure_to_that_structure |
| 16 | +from galaxy.tool_util_models.assertions import ( |
| 17 | + assertion_list, |
| 18 | + relaxed_assertion_list, |
| 19 | +) |
16 | 20 | from galaxy.util import asbool |
17 | 21 | from ._util import is_datasource |
18 | 22 |
|
@@ -148,15 +152,17 @@ def lint(cls, tool_source: "ToolSource", lint_ctx: "LintContext"): |
148 | 152 | lint_ctx.warn("Failed to parse test dictionaries from tool - cannot lint assertions") |
149 | 153 | return |
150 | 154 | assert "tests" in raw_tests_dict |
| 155 | + # This really only allows coercion from strings, the values themselves will still be validated |
| 156 | + assert_list_model = relaxed_assertion_list if tool_source.language == "xml" else assertion_list |
151 | 157 | for test_idx, test in enumerate(raw_tests_dict["tests"], start=1): |
152 | 158 | # TODO: validate command, command_version, element tests. What about children? |
153 | 159 | for output in test["outputs"]: |
154 | 160 | asserts_raw = output.get("attributes", {}).get("assert_list") or [] |
155 | | - to_yaml_assertions = [] |
| 161 | + processed_assertions = [] |
156 | 162 | for raw_assert in asserts_raw: |
157 | | - to_yaml_assertions.append({"that": raw_assert["tag"], **raw_assert.get("attributes", {})}) |
| 163 | + processed_assertions.append(tag_structure_to_that_structure(raw_assert)) |
158 | 164 | try: |
159 | | - assertion_list.model_validate(to_yaml_assertions) |
| 165 | + assert_list_model.model_validate(processed_assertions) |
160 | 166 | except Exception as e: |
161 | 167 | error_str = _cleanup_pydantic_error(e) |
162 | 168 | lint_ctx.warn( |
|
0 commit comments