diff --git a/lib/galaxy/tool_util/verify/codegen.py b/lib/galaxy/tool_util/verify/codegen.py index 1b28cff98dd..9e9b0b77eb2 100644 --- a/lib/galaxy/tool_util/verify/codegen.py +++ b/lib/galaxy/tool_util/verify/codegen.py @@ -27,7 +27,7 @@ from galaxy.tool_util.verify.asserts import assertion_module_and_functions from galaxy.tool_util.verify.asserts._types import AssertionParameter as AssertionParameterAnnotation from galaxy.util.commands import shell -models_path = os.path.join(os.path.dirname(__file__), "assertion_models.py") +models_path = os.path.join(os.path.dirname(__file__), "..", "..", "tool_util_models", "assertions.py") galaxy_xsd_path = os.path.join(os.path.dirname(__file__), "..", "xsd", "galaxy.xsd") Children = Literal["allowed", "required", "forbidden"] @@ -114,17 +114,19 @@ def check_non_negative_if_int(v: typing.Any): class base_{{assertion.name}}_model(AssertionModel): '''base model for {{assertion.name}} describing attributes.''' + model_config = ConfigDict(extra="forbid", title="base_{{assertion.name}}_model") {% for parameter in assertion.parameters %} {% if not parameter.is_deprecated %} {{ parameter.name }}: {{ parameter.type_str }} = Field( {{ parameter.field_default_str }}, + title="{{ parameter.title }}", description={{ assertion.name }}_{{ parameter.name }}_description, ) {% endif %} {% endfor %} {% if assertion.children in ["required", "allowed"] %} - children: typing.Optional["assertion_list"] = None - asserts: typing.Optional["assertion_list"] = None + children: typing.Optional["assertion_list"] = Field(None, title="Children") + asserts: typing.Optional["assertion_list"] = Field(None, title="Asserts") {% if assertion.children == "required" %} @model_validator(mode='before') @@ -139,17 +141,19 @@ class base_{{assertion.name}}_model(AssertionModel): class base_{{assertion.name}}_model_relaxed(AssertionModel): '''base model for {{assertion.name}} describing attributes.''' + model_config = ConfigDict(extra="forbid", title="base_{{assertion.name}}_model_relaxed") {% for parameter in assertion.parameters %} {% if not parameter.is_deprecated %} {{ parameter.name }}: {{ parameter.lax_type_str }} = Field( {{ parameter.field_default_str }}, + title="{{ parameter.title }}", description={{ assertion.name }}_{{ parameter.name }}_description, ) {% endif %} {% endfor %} {% if assertion.children in ["required", "allowed"] %} - children: typing.Optional["assertion_list"] = None - asserts: typing.Optional["assertion_list"] = None + children: typing.Optional["assertion_list"] = Field(None, title="Children") + asserts: typing.Optional["assertion_list"] = Field(None, title="Asserts") {% if assertion.children == "required" %} @model_validator(mode='before') @@ -164,15 +168,18 @@ class base_{{assertion.name}}_model_relaxed(AssertionModel): class {{assertion.name}}_model(base_{{assertion.name}}_model): r\"\"\"{{ assertion.docstring }}\"\"\" - that: Literal["{{assertion.name}}"] = "{{assertion.name}}" + model_config = ConfigDict(extra="forbid", title="{{ assertion.title }}") + that: Literal["{{assertion.name}}"] = Field("{{assertion.name}}", title="That") class {{assertion.name}}_model_nested(AssertionModel): r\"\"\"Nested version of this assertion model.\"\"\" - {{assertion.name}}: base_{{assertion.name}}_model + model_config = ConfigDict(extra="forbid", title="{{ assertion.title }} (Nested)") + {{assertion.name}}: base_{{assertion.name}}_model = Field(..., title="{{ assertion.title }}") class {{assertion.name}}_model_relaxed(base_{{assertion.name}}_model_relaxed): r\"\"\"{{ assertion.docstring }}\"\"\" - that: Literal["{{assertion.name}}"] = "{{assertion.name}}" + model_config = ConfigDict(extra="forbid", title="{{ assertion.title }} (Relaxed)") + that: Literal["{{assertion.name}}"] = Field("{{assertion.name}}", title="That") {% endfor %} any_assertion_model_flat = Annotated[typing.Union[ @@ -193,15 +200,19 @@ any_assertion_model_flat_relaxed = Annotated[typing.Union[ {% endfor %} ], Field(discriminator="that")] -assertion_list = RootModel[typing.List[typing.Union[any_assertion_model_flat, any_assertion_model_nested]]] +class assertion_list(RootModel[typing.List[typing.Union[any_assertion_model_flat, any_assertion_model_nested]]]): + model_config = ConfigDict(title="assertion_list") + # used to model what the XML conversion should look like - not meant to be consumed outside of # of Galaxy internals / linting. -relaxed_assertion_list = RootModel[typing.List[any_assertion_model_flat_relaxed]] +class relaxed_assertion_list(RootModel[typing.List[any_assertion_model_flat_relaxed]]): + model_config = ConfigDict(title="relaxed_assertion_list") class assertion_dict(AssertionModel): + model_config = ConfigDict(extra="forbid", title="assertion_dict") {% for assertion in assertions %} - {{assertion.name}}: typing.Optional[base_{{assertion.name}}_model] = None + {{assertion.name}}: typing.Optional[base_{{assertion.name}}_model] = Field(None, title="{{ assertion.title }}") {% endfor %} @@ -338,6 +349,10 @@ class AssertionParameter: self.type = type self.default_value = default_value + @property + def title(self) -> str: + return " ".join(w.capitalize() for w in self.name.split("_")) + @property def description(self) -> str: type = self.type @@ -490,6 +505,10 @@ class Assertion: self.children = children self.module_and_function = module_and_function + @property + def title(self) -> str: + return "Assert " + " ".join(w.capitalize() for w in self.name.split("_")) + def arg_parser() -> argparse.ArgumentParser: parser = argparse.ArgumentParser(description=DESCRIPTION) diff --git a/lib/galaxy/tool_util_models/__init__.py b/lib/galaxy/tool_util_models/__init__.py index adaf69413b4..fb0f6629de2 100644 --- a/lib/galaxy/tool_util_models/__init__.py +++ b/lib/galaxy/tool_util_models/__init__.py @@ -172,33 +172,153 @@ class ParsedTool(ToolSourceBaseModel): class BaseTestOutputModel(StrictModel): - file: Optional[str] = None - path: Optional[str] = None - location: Optional[AnyUrl] = None - ftype: Optional[str] = None - sort: Optional[bool] = None - compare: Optional[OutputCompareType] = None - checksum: Optional[str] = None - metadata: Optional[Dict[str, Any]] = None - asserts: Optional[assertions] = None - delta: Optional[int] = None - delta_frac: Optional[float] = None - lines_diff: Optional[int] = None - decompress: Optional[bool] = None + model_config = ConfigDict(extra="forbid", title="BaseTestOutputModel") + file: Annotated[ + Optional[str], + Field( + title="File", + description=( + "Name of the output file stored in the target `test-data` directory that will be used to " + "compare against the results of executing the tool via the functional test framework." + ), + ), + ] = None + path: Annotated[ + Optional[str], + Field(title="Path", description="Filesystem path to a local output file used for comparison."), + ] = None + location: Annotated[ + Optional[AnyUrl], + Field( + title="Location", + description=( + "URL that points to a remote output file that will be downloaded and used for output " + "comparison. Use only when the file cannot be included in the `test-data` folder. May be " + "combined with `file` (downloads when missing on disk) or used alone (filename inferred " + "from the URL). A `checksum` is also used to verify the download when provided." + ), + ), + ] = None + ftype: Annotated[ + Optional[str], + Field( + title="File Type", + description=( + "If specified, this value is checked against the corresponding output's data type. " + "If these do not match, the test will fail." + ), + ), + ] = None + sort: Annotated[ + Optional[bool], + Field( + title="Sort", + description=( + "Applies only if `compare` is `diff`, `re_match` or `re_match_multiline`. Sorts the lines " + "of the history data set before comparison; for `diff` and `re_match` the local file is " + "also sorted. Useful for non-deterministic output." + ), + ), + ] = None + compare: Annotated[ + Optional[OutputCompareType], + Field( + title="Compare", + description="Comparison mode used when matching the output against the reference file.", + ), + ] = None + checksum: Annotated[ + Optional[str], + Field( + title="Checksum", + description=( + "The target output's checksum should match the value specified here, in the form " + "`hash_type$hash_value` (e.g. `sha1$8156d7ca0f46ed7abac98f82e36cfaddb2aca041`). Useful " + "for large static files where uploading the whole file is inconvenient." + ), + ), + ] = None + metadata: Annotated[ + Optional[Dict[str, Any]], + Field( + title="Metadata", + description="Mapping of metadata keys to expected values for this output.", + ), + ] = None + asserts: Annotated[ + Optional[assertions], + Field(title="Asserts", description="Assertions about the content of the output."), + ] = None + delta: Annotated[ + Optional[int], + Field( + title="Delta", + description=( + "If `compare` is set to `sim_size`, the maximum allowed absolute size difference (in " + "bytes) between the generated data set and the reference file in `test-data/`. Default " + "is 10000 bytes. Can be combined with `delta_frac`." + ), + ), + ] = None + delta_frac: Annotated[ + Optional[float], + Field( + title="Delta Frac", + description=( + "If `compare` is set to `sim_size`, the maximum allowed relative size difference between " + "the generated data set and the reference file in `test-data/`. 0.1 means the generated " + "file can differ by at most 10%. Default is not to check for relative size difference. " + "Can be combined with `delta`." + ), + ), + ] = None + lines_diff: Annotated[ + Optional[int], + Field( + title="Lines Diff", + description=( + "Applies when `compare` is set to `diff`, `re_match`, or `contains`. For `diff`, the " + "number of lines of difference to allow (a modified line counts as two: one added, one " + "removed)." + ), + ), + ] = None + decompress: Annotated[ + Optional[bool], + Field( + title="Decompress", + description=( + "If true, decompress files before comparison. Applies to assertions expressed with " + "`assert_contents` or `compare` set to anything but `sim_size`. Useful for testing " + "compressed outputs that are non-deterministic despite having deterministic decompressed " + "contents. By default, only files compressed with bz2, gzip and zip are automatically " + "decompressed." + ), + ), + ] = None class TestDataOutputAssertions(BaseTestOutputModel): - class_: Optional[Literal["File"]] = Field("File", alias="class") + model_config = ConfigDict(extra="forbid", title="TestDataOutputAssertions") + class_: Optional[Literal["File"]] = Field("File", alias="class", title="Class") class TestCollectionCollectionElementAssertions(StrictModel): - class_: Optional[Literal["Collection"]] = Field("Collection", alias="class") - elements: Optional[Dict[str, "TestCollectionElementAssertion"]] = None - element_tests: Optional[Dict[str, "TestCollectionElementAssertion"]] = None + model_config = ConfigDict(extra="forbid", title="TestCollectionCollectionElementAssertions") + class_: Optional[Literal["Collection"]] = Field("Collection", alias="class", title="Class") + elements: Annotated[ + Optional[Dict[str, "TestCollectionElementAssertion"]], + Field(title="Elements"), + ] = None + element_tests: Annotated[ + Optional[Dict[str, "TestCollectionElementAssertion"]], + Field(title="Element Tests"), + ] = None class TestCollectionDatasetElementAssertions(BaseTestOutputModel): - class_: Optional[Literal["File"]] = Field("File", alias="class") + model_config = ConfigDict(extra="forbid", title="TestCollectionDatasetElementAssertions") + class_: Optional[Literal["File"]] = Field("File", alias="class", title="Class") def _discriminate_collection_element(v): @@ -224,16 +344,24 @@ TestCollectionCollectionElementAssertions.model_rebuild() class CollectionAttributes(StrictModel): - collection_type: CollectionType = None + model_config = ConfigDict(extra="forbid", title="CollectionAttributes") + collection_type: Annotated[CollectionType, Field(title="Collection Type")] = None class TestCollectionOutputAssertions(StrictModel): - class_: Optional[Literal["Collection"]] = Field("Collection", alias="class") - elements: Optional[Dict[str, TestCollectionElementAssertion]] = None - element_tests: Optional[Dict[str, "TestCollectionElementAssertion"]] = None - element_count: Optional[int] = None - attributes: Optional[CollectionAttributes] = None - collection_type: CollectionType = None + model_config = ConfigDict(extra="forbid", title="TestCollectionOutputAssertions") + class_: Optional[Literal["Collection"]] = Field("Collection", alias="class", title="Class") + elements: Annotated[ + Optional[Dict[str, TestCollectionElementAssertion]], + Field(title="Elements"), + ] = None + element_tests: Annotated[ + Optional[Dict[str, "TestCollectionElementAssertion"]], + Field(title="Element Tests"), + ] = None + element_count: Annotated[Optional[int], Field(title="Element Count")] = None + attributes: Annotated[Optional[CollectionAttributes], Field(title="Attributes")] = None + collection_type: Annotated[CollectionType, Field(title="Collection Type")] = None TestOutputLiteral = Union[bool, int, float, str] @@ -267,23 +395,25 @@ TestInputValue = Union[bool, int, float, str, List[Any], Dict[str, Any]] class YamlTestCredentialValue(StrictModel): - name: Annotated[str, Field(description="Name of the credential variable or secret.")] - value: Annotated[str, Field(description="Value of the credential variable or secret.")] + model_config = ConfigDict(extra="forbid", title="YamlTestCredentialValue") + name: Annotated[str, Field(title="Name", description="Name of the credential variable or secret.")] + value: Annotated[str, Field(title="Value", description="Value of the credential variable or secret.")] class YamlTestCredential(StrictModel): - name: Annotated[str, Field(description="Name of the credentials group.")] + model_config = ConfigDict(extra="forbid", title="YamlTestCredential") + name: Annotated[str, Field(title="Name", description="Name of the credentials group.")] variables: Annotated[ List[YamlTestCredentialValue], - Field(description="Variables exposed to the tool environment."), + Field(title="Variables", description="Variables exposed to the tool environment."), ] = [] secrets: Annotated[ List[YamlTestCredentialValue], - Field(description="Secrets exposed to the tool environment."), + Field(title="Secrets", description="Secrets exposed to the tool environment."), ] = [] version: Annotated[ Optional[str], - Field(description="Version of the credential definition."), + Field(title="Version", description="Version of the credential definition."), ] = None @@ -341,13 +471,52 @@ JobDict = Dict[str, Any] class TestJob(StrictModel): - doc: Optional[str] - job: Job - outputs: Dict[str, TestOutputAssertions] - expect_failure: Optional[bool] = False + model_config = ConfigDict(extra="forbid", title="TestJob") + doc: Annotated[ + Optional[str], + Field(title="Doc", description="Describes the purpose of the test."), + ] = None + job: Annotated[ + Job, + Field( + title="Job", + description=( + "Defines the job to execute. Can be a path to a file or an inline dictionary describing " + "the job inputs." + ), + ), + ] + outputs: Annotated[ + Dict[str, TestOutputAssertions], + Field( + title="Outputs", + description=( + "Defines assertions about outputs (datasets, collections or parameters). Each key " + "corresponds to a labeled output; values are dictionaries describing the expected output." + ), + ), + ] + expect_failure: Annotated[ + Optional[bool], + Field( + title="Expect Failure", + description="If true, the workflow is expected to produce an error.", + ), + ] = False -Tests = RootModel[List[TestJob]] +class Tests(RootModel[List[TestJob]]): + model_config = ConfigDict( + title="GalaxyWorkflowTests", + json_schema_extra={ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": ( + "Galaxy workflow tests file — a YAML list of test entries asserting the expected " + "inputs and outputs of a workflow run." + ), + }, + ) + # TODO: typed dict versions of all thee above for verify code - make this Dict[str, Any] here more # specific. diff --git a/lib/galaxy/tool_util_models/_base.py b/lib/galaxy/tool_util_models/_base.py index bd082f181b2..cf53028b625 100644 --- a/lib/galaxy/tool_util_models/_base.py +++ b/lib/galaxy/tool_util_models/_base.py @@ -11,11 +11,11 @@ from typing_extensions import Annotated class ToolSourceBaseModel(BaseModel): - model_config = ConfigDict(field_title_generator=lambda field_name, field_info: field_name.lower()) + pass class StrictModel(BaseModel): - model_config = ConfigDict(extra="forbid", field_title_generator=lambda field_name, field_info: field_name.lower()) + model_config = ConfigDict(extra="forbid") def _check_collection_type(v: str) -> str: diff --git a/lib/galaxy/tool_util_models/assertions.py b/lib/galaxy/tool_util_models/assertions.py index be14dc39a1b..cc03f2adb8f 100644 --- a/lib/galaxy/tool_util_models/assertions.py +++ b/lib/galaxy/tool_util_models/assertions.py @@ -84,8 +84,11 @@ has_line_negate_description = """A boolean that can be set to true to negate the class base_has_line_model(AssertionModel): """base model for has_line describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_line_model") + line: str = Field( ..., + title="Line", description=has_line_line_description, ) @@ -95,6 +98,7 @@ class base_has_line_model(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="N", description=has_line_n_description, ) @@ -102,6 +106,7 @@ class base_has_line_model(AssertionModel): typing.Union[int, str], BeforeValidator(check_bytes), BeforeValidator(check_non_negative_if_int) ] = Field( 0, + title="Delta", description=has_line_delta_description, ) @@ -111,6 +116,7 @@ class base_has_line_model(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Min", description=has_line_min_description, ) @@ -120,11 +126,13 @@ class base_has_line_model(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Max", description=has_line_max_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=has_line_negate_description, ) @@ -132,8 +140,11 @@ class base_has_line_model(AssertionModel): class base_has_line_model_relaxed(AssertionModel): """base model for has_line describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_line_model_relaxed") + line: str = Field( ..., + title="Line", description=has_line_line_description, ) @@ -143,6 +154,7 @@ class base_has_line_model_relaxed(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="N", description=has_line_n_description, ) @@ -150,6 +162,7 @@ class base_has_line_model_relaxed(AssertionModel): typing.Union[int, str], BeforeValidator(check_bytes), BeforeValidator(check_non_negative_if_int) ] = Field( 0, + title="Delta", description=has_line_delta_description, ) @@ -159,6 +172,7 @@ class base_has_line_model_relaxed(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Min", description=has_line_min_description, ) @@ -168,11 +182,13 @@ class base_has_line_model_relaxed(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Max", description=has_line_max_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=has_line_negate_description, ) @@ -182,13 +198,15 @@ class has_line_model(base_has_line_model): argument line. The exact number of occurrences can be optionally specified by the argument n""" - that: Literal["has_line"] = "has_line" + model_config = ConfigDict(extra="forbid", title="Assert Has Line") + that: Literal["has_line"] = Field("has_line", title="That") class has_line_model_nested(AssertionModel): r"""Nested version of this assertion model.""" - has_line: base_has_line_model + model_config = ConfigDict(extra="forbid", title="Assert Has Line (Nested)") + has_line: base_has_line_model = Field(..., title="Assert Has Line") class has_line_model_relaxed(base_has_line_model_relaxed): @@ -196,7 +214,8 @@ class has_line_model_relaxed(base_has_line_model_relaxed): argument line. The exact number of occurrences can be optionally specified by the argument n""" - that: Literal["has_line"] = "has_line" + model_config = ConfigDict(extra="forbid", title="Assert Has Line (Relaxed)") + that: Literal["has_line"] = Field("has_line", title="That") has_line_matching_expression_description = """The regular expressions to attempt match in the output.""" @@ -217,8 +236,11 @@ has_line_matching_negate_description = """A boolean that can be set to true to n class base_has_line_matching_model(AssertionModel): """base model for has_line_matching describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_line_matching_model") + expression: str = Field( ..., + title="Expression", description=has_line_matching_expression_description, ) @@ -228,6 +250,7 @@ class base_has_line_matching_model(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="N", description=has_line_matching_n_description, ) @@ -235,6 +258,7 @@ class base_has_line_matching_model(AssertionModel): typing.Union[int, str], BeforeValidator(check_bytes), BeforeValidator(check_non_negative_if_int) ] = Field( 0, + title="Delta", description=has_line_matching_delta_description, ) @@ -244,6 +268,7 @@ class base_has_line_matching_model(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Min", description=has_line_matching_min_description, ) @@ -253,11 +278,13 @@ class base_has_line_matching_model(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Max", description=has_line_matching_max_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=has_line_matching_negate_description, ) @@ -265,8 +292,11 @@ class base_has_line_matching_model(AssertionModel): class base_has_line_matching_model_relaxed(AssertionModel): """base model for has_line_matching describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_line_matching_model_relaxed") + expression: str = Field( ..., + title="Expression", description=has_line_matching_expression_description, ) @@ -276,6 +306,7 @@ class base_has_line_matching_model_relaxed(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="N", description=has_line_matching_n_description, ) @@ -283,6 +314,7 @@ class base_has_line_matching_model_relaxed(AssertionModel): typing.Union[int, str], BeforeValidator(check_bytes), BeforeValidator(check_non_negative_if_int) ] = Field( 0, + title="Delta", description=has_line_matching_delta_description, ) @@ -292,6 +324,7 @@ class base_has_line_matching_model_relaxed(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Min", description=has_line_matching_min_description, ) @@ -301,11 +334,13 @@ class base_has_line_matching_model_relaxed(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Max", description=has_line_matching_max_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=has_line_matching_negate_description, ) @@ -313,23 +348,26 @@ class base_has_line_matching_model_relaxed(AssertionModel): class has_line_matching_model(base_has_line_matching_model): r"""Asserts the specified output contains a line matching the regular expression specified by the argument expression. If n is given - the assertion checks for exactly n occurrences.""" + the assertion checks for exactly n occurences.""" - that: Literal["has_line_matching"] = "has_line_matching" + model_config = ConfigDict(extra="forbid", title="Assert Has Line Matching") + that: Literal["has_line_matching"] = Field("has_line_matching", title="That") class has_line_matching_model_nested(AssertionModel): r"""Nested version of this assertion model.""" - has_line_matching: base_has_line_matching_model + model_config = ConfigDict(extra="forbid", title="Assert Has Line Matching (Nested)") + has_line_matching: base_has_line_matching_model = Field(..., title="Assert Has Line Matching") class has_line_matching_model_relaxed(base_has_line_matching_model_relaxed): r"""Asserts the specified output contains a line matching the regular expression specified by the argument expression. If n is given - the assertion checks for exactly n occurrences.""" + the assertion checks for exactly n occurences.""" - that: Literal["has_line_matching"] = "has_line_matching" + model_config = ConfigDict(extra="forbid", title="Assert Has Line Matching (Relaxed)") + that: Literal["has_line_matching"] = Field("has_line_matching", title="That") has_n_lines_n_description = """Desired number, can be suffixed by ``(k|M|G|T|P|E)i?``""" @@ -348,12 +386,15 @@ has_n_lines_negate_description = """A boolean that can be set to true to negate class base_has_n_lines_model(AssertionModel): """base model for has_n_lines describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_n_lines_model") + n: Annotated[ typing.Optional[typing.Union[str, int]], BeforeValidator(check_bytes), BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="N", description=has_n_lines_n_description, ) @@ -361,6 +402,7 @@ class base_has_n_lines_model(AssertionModel): typing.Union[int, str], BeforeValidator(check_bytes), BeforeValidator(check_non_negative_if_int) ] = Field( 0, + title="Delta", description=has_n_lines_delta_description, ) @@ -370,6 +412,7 @@ class base_has_n_lines_model(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Min", description=has_n_lines_min_description, ) @@ -379,11 +422,13 @@ class base_has_n_lines_model(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Max", description=has_n_lines_max_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=has_n_lines_negate_description, ) @@ -391,12 +436,15 @@ class base_has_n_lines_model(AssertionModel): class base_has_n_lines_model_relaxed(AssertionModel): """base model for has_n_lines describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_n_lines_model_relaxed") + n: Annotated[ typing.Optional[typing.Union[str, int]], BeforeValidator(check_bytes), BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="N", description=has_n_lines_n_description, ) @@ -404,6 +452,7 @@ class base_has_n_lines_model_relaxed(AssertionModel): typing.Union[int, str], BeforeValidator(check_bytes), BeforeValidator(check_non_negative_if_int) ] = Field( 0, + title="Delta", description=has_n_lines_delta_description, ) @@ -413,6 +462,7 @@ class base_has_n_lines_model_relaxed(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Min", description=has_n_lines_min_description, ) @@ -422,11 +472,13 @@ class base_has_n_lines_model_relaxed(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Max", description=has_n_lines_max_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=has_n_lines_negate_description, ) @@ -436,13 +488,15 @@ class has_n_lines_model(base_has_n_lines_model): for a difference in the number of lines (delta) or relative differebce in the number of lines""" - that: Literal["has_n_lines"] = "has_n_lines" + model_config = ConfigDict(extra="forbid", title="Assert Has N Lines") + that: Literal["has_n_lines"] = Field("has_n_lines", title="That") class has_n_lines_model_nested(AssertionModel): r"""Nested version of this assertion model.""" - has_n_lines: base_has_n_lines_model + model_config = ConfigDict(extra="forbid", title="Assert Has N Lines (Nested)") + has_n_lines: base_has_n_lines_model = Field(..., title="Assert Has N Lines") class has_n_lines_model_relaxed(base_has_n_lines_model_relaxed): @@ -450,7 +504,8 @@ class has_n_lines_model_relaxed(base_has_n_lines_model_relaxed): for a difference in the number of lines (delta) or relative differebce in the number of lines""" - that: Literal["has_n_lines"] = "has_n_lines" + model_config = ConfigDict(extra="forbid", title="Assert Has N Lines (Relaxed)") + that: Literal["has_n_lines"] = Field("has_n_lines", title="That") has_text_text_description = """The text to search for in the output.""" @@ -471,8 +526,11 @@ has_text_negate_description = """A boolean that can be set to true to negate the class base_has_text_model(AssertionModel): """base model for has_text describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_text_model") + text: str = Field( ..., + title="Text", description=has_text_text_description, ) @@ -482,6 +540,7 @@ class base_has_text_model(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="N", description=has_text_n_description, ) @@ -489,6 +548,7 @@ class base_has_text_model(AssertionModel): typing.Union[int, str], BeforeValidator(check_bytes), BeforeValidator(check_non_negative_if_int) ] = Field( 0, + title="Delta", description=has_text_delta_description, ) @@ -498,6 +558,7 @@ class base_has_text_model(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Min", description=has_text_min_description, ) @@ -507,11 +568,13 @@ class base_has_text_model(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Max", description=has_text_max_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=has_text_negate_description, ) @@ -519,8 +582,11 @@ class base_has_text_model(AssertionModel): class base_has_text_model_relaxed(AssertionModel): """base model for has_text describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_text_model_relaxed") + text: str = Field( ..., + title="Text", description=has_text_text_description, ) @@ -530,6 +596,7 @@ class base_has_text_model_relaxed(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="N", description=has_text_n_description, ) @@ -537,6 +604,7 @@ class base_has_text_model_relaxed(AssertionModel): typing.Union[int, str], BeforeValidator(check_bytes), BeforeValidator(check_non_negative_if_int) ] = Field( 0, + title="Delta", description=has_text_delta_description, ) @@ -546,6 +614,7 @@ class base_has_text_model_relaxed(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Min", description=has_text_min_description, ) @@ -555,11 +624,13 @@ class base_has_text_model_relaxed(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Max", description=has_text_max_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=has_text_negate_description, ) @@ -569,13 +640,15 @@ class has_text_model(base_has_text_model): the argument text. The exact number of occurrences can be optionally specified by the argument n""" - that: Literal["has_text"] = "has_text" + model_config = ConfigDict(extra="forbid", title="Assert Has Text") + that: Literal["has_text"] = Field("has_text", title="That") class has_text_model_nested(AssertionModel): r"""Nested version of this assertion model.""" - has_text: base_has_text_model + model_config = ConfigDict(extra="forbid", title="Assert Has Text (Nested)") + has_text: base_has_text_model = Field(..., title="Assert Has Text") class has_text_model_relaxed(base_has_text_model_relaxed): @@ -583,7 +656,8 @@ class has_text_model_relaxed(base_has_text_model_relaxed): the argument text. The exact number of occurrences can be optionally specified by the argument n""" - that: Literal["has_text"] = "has_text" + model_config = ConfigDict(extra="forbid", title="Assert Has Text (Relaxed)") + that: Literal["has_text"] = Field("has_text", title="That") has_text_matching_expression_description = """The regular expressions to attempt match in the output.""" @@ -604,8 +678,11 @@ has_text_matching_negate_description = """A boolean that can be set to true to n class base_has_text_matching_model(AssertionModel): """base model for has_text_matching describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_text_matching_model") + expression: str = Field( ..., + title="Expression", description=has_text_matching_expression_description, ) @@ -615,6 +692,7 @@ class base_has_text_matching_model(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="N", description=has_text_matching_n_description, ) @@ -622,6 +700,7 @@ class base_has_text_matching_model(AssertionModel): typing.Union[int, str], BeforeValidator(check_bytes), BeforeValidator(check_non_negative_if_int) ] = Field( 0, + title="Delta", description=has_text_matching_delta_description, ) @@ -631,6 +710,7 @@ class base_has_text_matching_model(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Min", description=has_text_matching_min_description, ) @@ -640,11 +720,13 @@ class base_has_text_matching_model(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Max", description=has_text_matching_max_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=has_text_matching_negate_description, ) @@ -652,8 +734,11 @@ class base_has_text_matching_model(AssertionModel): class base_has_text_matching_model_relaxed(AssertionModel): """base model for has_text_matching describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_text_matching_model_relaxed") + expression: str = Field( ..., + title="Expression", description=has_text_matching_expression_description, ) @@ -663,6 +748,7 @@ class base_has_text_matching_model_relaxed(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="N", description=has_text_matching_n_description, ) @@ -670,6 +756,7 @@ class base_has_text_matching_model_relaxed(AssertionModel): typing.Union[int, str], BeforeValidator(check_bytes), BeforeValidator(check_non_negative_if_int) ] = Field( 0, + title="Delta", description=has_text_matching_delta_description, ) @@ -679,6 +766,7 @@ class base_has_text_matching_model_relaxed(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Min", description=has_text_matching_min_description, ) @@ -688,11 +776,13 @@ class base_has_text_matching_model_relaxed(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Max", description=has_text_matching_max_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=has_text_matching_negate_description, ) @@ -700,25 +790,28 @@ class base_has_text_matching_model_relaxed(AssertionModel): class has_text_matching_model(base_has_text_matching_model): r"""Asserts the specified output contains text matching the regular expression specified by the argument expression. - If n is given the assertion checks for exactly n (nonoverlapping) - occurrences.""" + If n is given the assertion checks for exacly n (nonoverlapping) + occurences.""" - that: Literal["has_text_matching"] = "has_text_matching" + model_config = ConfigDict(extra="forbid", title="Assert Has Text Matching") + that: Literal["has_text_matching"] = Field("has_text_matching", title="That") class has_text_matching_model_nested(AssertionModel): r"""Nested version of this assertion model.""" - has_text_matching: base_has_text_matching_model + model_config = ConfigDict(extra="forbid", title="Assert Has Text Matching (Nested)") + has_text_matching: base_has_text_matching_model = Field(..., title="Assert Has Text Matching") class has_text_matching_model_relaxed(base_has_text_matching_model_relaxed): r"""Asserts the specified output contains text matching the regular expression specified by the argument expression. - If n is given the assertion checks for exactly n (nonoverlapping) - occurrences.""" + If n is given the assertion checks for exacly n (nonoverlapping) + occurences.""" - that: Literal["has_text_matching"] = "has_text_matching" + model_config = ConfigDict(extra="forbid", title="Assert Has Text Matching (Relaxed)") + that: Literal["has_text_matching"] = Field("has_text_matching", title="That") not_has_text_text_description = """The text to search for in the output.""" @@ -727,8 +820,11 @@ not_has_text_text_description = """The text to search for in the output.""" class base_not_has_text_model(AssertionModel): """base model for not_has_text describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_not_has_text_model") + text: str = Field( ..., + title="Text", description=not_has_text_text_description, ) @@ -736,8 +832,11 @@ class base_not_has_text_model(AssertionModel): class base_not_has_text_model_relaxed(AssertionModel): """base model for not_has_text describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_not_has_text_model_relaxed") + text: str = Field( ..., + title="Text", description=not_has_text_text_description, ) @@ -746,20 +845,23 @@ class not_has_text_model(base_not_has_text_model): r"""Asserts specified output does not contain the substring specified by the argument text""" - that: Literal["not_has_text"] = "not_has_text" + model_config = ConfigDict(extra="forbid", title="Assert Not Has Text") + that: Literal["not_has_text"] = Field("not_has_text", title="That") class not_has_text_model_nested(AssertionModel): r"""Nested version of this assertion model.""" - not_has_text: base_not_has_text_model + model_config = ConfigDict(extra="forbid", title="Assert Not Has Text (Nested)") + not_has_text: base_not_has_text_model = Field(..., title="Assert Not Has Text") class not_has_text_model_relaxed(base_not_has_text_model_relaxed): r"""Asserts specified output does not contain the substring specified by the argument text""" - that: Literal["not_has_text"] = "not_has_text" + model_config = ConfigDict(extra="forbid", title="Assert Not Has Text (Relaxed)") + that: Literal["not_has_text"] = Field("not_has_text", title="That") has_n_columns_n_description = """Desired number, can be suffixed by ``(k|M|G|T|P|E)i?``""" @@ -784,12 +886,15 @@ has_n_columns_negate_description = """A boolean that can be set to true to negat class base_has_n_columns_model(AssertionModel): """base model for has_n_columns describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_n_columns_model") + n: Annotated[ typing.Optional[typing.Union[str, int]], BeforeValidator(check_bytes), BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="N", description=has_n_columns_n_description, ) @@ -797,6 +902,7 @@ class base_has_n_columns_model(AssertionModel): typing.Union[int, str], BeforeValidator(check_bytes), BeforeValidator(check_non_negative_if_int) ] = Field( 0, + title="Delta", description=has_n_columns_delta_description, ) @@ -806,6 +912,7 @@ class base_has_n_columns_model(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Min", description=has_n_columns_min_description, ) @@ -815,21 +922,25 @@ class base_has_n_columns_model(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Max", description=has_n_columns_max_description, ) sep: str = Field( " ", + title="Sep", description=has_n_columns_sep_description, ) comment: str = Field( "", + title="Comment", description=has_n_columns_comment_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=has_n_columns_negate_description, ) @@ -837,12 +948,15 @@ class base_has_n_columns_model(AssertionModel): class base_has_n_columns_model_relaxed(AssertionModel): """base model for has_n_columns describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_n_columns_model_relaxed") + n: Annotated[ typing.Optional[typing.Union[str, int]], BeforeValidator(check_bytes), BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="N", description=has_n_columns_n_description, ) @@ -850,6 +964,7 @@ class base_has_n_columns_model_relaxed(AssertionModel): typing.Union[int, str], BeforeValidator(check_bytes), BeforeValidator(check_non_negative_if_int) ] = Field( 0, + title="Delta", description=has_n_columns_delta_description, ) @@ -859,6 +974,7 @@ class base_has_n_columns_model_relaxed(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Min", description=has_n_columns_min_description, ) @@ -868,21 +984,25 @@ class base_has_n_columns_model_relaxed(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Max", description=has_n_columns_max_description, ) sep: str = Field( " ", + title="Sep", description=has_n_columns_sep_description, ) comment: str = Field( "", + title="Comment", description=has_n_columns_comment_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=has_n_columns_negate_description, ) @@ -893,19 +1013,21 @@ class has_n_columns_model(base_has_n_columns_model): For instance, ````. The assertion tests only the first line. Number of columns can optionally also be specified with ``delta``. Alternatively the - range of expected occurrences can be specified by ``min`` and/or ``max``. + range of expected occurences can be specified by ``min`` and/or ``max``. Optionally a column separator (``sep``, default is `` ``) `and comment character(s) can be specified (``comment``, default is empty string). The first non-comment line is used for determining the number of columns.""" - that: Literal["has_n_columns"] = "has_n_columns" + model_config = ConfigDict(extra="forbid", title="Assert Has N Columns") + that: Literal["has_n_columns"] = Field("has_n_columns", title="That") class has_n_columns_model_nested(AssertionModel): r"""Nested version of this assertion model.""" - has_n_columns: base_has_n_columns_model + model_config = ConfigDict(extra="forbid", title="Assert Has N Columns (Nested)") + has_n_columns: base_has_n_columns_model = Field(..., title="Assert Has N Columns") class has_n_columns_model_relaxed(base_has_n_columns_model_relaxed): @@ -914,13 +1036,14 @@ class has_n_columns_model_relaxed(base_has_n_columns_model_relaxed): For instance, ````. The assertion tests only the first line. Number of columns can optionally also be specified with ``delta``. Alternatively the - range of expected occurrences can be specified by ``min`` and/or ``max``. + range of expected occurences can be specified by ``min`` and/or ``max``. Optionally a column separator (``sep``, default is `` ``) `and comment character(s) can be specified (``comment``, default is empty string). The first non-comment line is used for determining the number of columns.""" - that: Literal["has_n_columns"] = "has_n_columns" + model_config = ConfigDict(extra="forbid", title="Assert Has N Columns (Relaxed)") + that: Literal["has_n_columns"] = Field("has_n_columns", title="That") attribute_is_path_description = """The Python xpath-like expression to find the target element.""" @@ -935,23 +1058,29 @@ attribute_is_negate_description = """A boolean that can be set to true to negate class base_attribute_is_model(AssertionModel): """base model for attribute_is describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_attribute_is_model") + path: str = Field( ..., + title="Path", description=attribute_is_path_description, ) attribute: str = Field( ..., + title="Attribute", description=attribute_is_attribute_description, ) text: str = Field( ..., + title="Text", description=attribute_is_text_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=attribute_is_negate_description, ) @@ -959,23 +1088,29 @@ class base_attribute_is_model(AssertionModel): class base_attribute_is_model_relaxed(AssertionModel): """base model for attribute_is describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_attribute_is_model_relaxed") + path: str = Field( ..., + title="Path", description=attribute_is_path_description, ) attribute: str = Field( ..., + title="Attribute", description=attribute_is_attribute_description, ) text: str = Field( ..., + title="Text", description=attribute_is_text_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=attribute_is_negate_description, ) @@ -994,13 +1129,15 @@ class attribute_is_model(base_attribute_is_model): With ``negate`` the result of the assertion (on the equality) can be inverted (the implicit assertion on the existence of the path is not affected).""" - that: Literal["attribute_is"] = "attribute_is" + model_config = ConfigDict(extra="forbid", title="Assert Attribute Is") + that: Literal["attribute_is"] = Field("attribute_is", title="That") class attribute_is_model_nested(AssertionModel): r"""Nested version of this assertion model.""" - attribute_is: base_attribute_is_model + model_config = ConfigDict(extra="forbid", title="Assert Attribute Is (Nested)") + attribute_is: base_attribute_is_model = Field(..., title="Assert Attribute Is") class attribute_is_model_relaxed(base_attribute_is_model_relaxed): @@ -1017,7 +1154,8 @@ class attribute_is_model_relaxed(base_attribute_is_model_relaxed): With ``negate`` the result of the assertion (on the equality) can be inverted (the implicit assertion on the existence of the path is not affected).""" - that: Literal["attribute_is"] = "attribute_is" + model_config = ConfigDict(extra="forbid", title="Assert Attribute Is (Relaxed)") + that: Literal["attribute_is"] = Field("attribute_is", title="That") attribute_matches_path_description = """The Python xpath-like expression to find the target element.""" @@ -1034,23 +1172,29 @@ attribute_matches_negate_description = """A boolean that can be set to true to n class base_attribute_matches_model(AssertionModel): """base model for attribute_matches describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_attribute_matches_model") + path: str = Field( ..., + title="Path", description=attribute_matches_path_description, ) attribute: str = Field( ..., + title="Attribute", description=attribute_matches_attribute_description, ) expression: Annotated[str, BeforeValidator(check_regex)] = Field( ..., + title="Expression", description=attribute_matches_expression_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=attribute_matches_negate_description, ) @@ -1058,23 +1202,29 @@ class base_attribute_matches_model(AssertionModel): class base_attribute_matches_model_relaxed(AssertionModel): """base model for attribute_matches describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_attribute_matches_model_relaxed") + path: str = Field( ..., + title="Path", description=attribute_matches_path_description, ) attribute: str = Field( ..., + title="Attribute", description=attribute_matches_attribute_description, ) expression: Annotated[str, BeforeValidator(check_regex)] = Field( ..., + title="Expression", description=attribute_matches_expression_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=attribute_matches_negate_description, ) @@ -1093,13 +1243,15 @@ class attribute_matches_model(base_attribute_matches_model): With ``negate`` the result of the assertion (on the matching) can be inverted (the implicit assertion on the existence of the path is not affected).""" - that: Literal["attribute_matches"] = "attribute_matches" + model_config = ConfigDict(extra="forbid", title="Assert Attribute Matches") + that: Literal["attribute_matches"] = Field("attribute_matches", title="That") class attribute_matches_model_nested(AssertionModel): r"""Nested version of this assertion model.""" - attribute_matches: base_attribute_matches_model + model_config = ConfigDict(extra="forbid", title="Assert Attribute Matches (Nested)") + attribute_matches: base_attribute_matches_model = Field(..., title="Assert Attribute Matches") class attribute_matches_model_relaxed(base_attribute_matches_model_relaxed): @@ -1116,7 +1268,8 @@ class attribute_matches_model_relaxed(base_attribute_matches_model_relaxed): With ``negate`` the result of the assertion (on the matching) can be inverted (the implicit assertion on the existence of the path is not affected).""" - that: Literal["attribute_matches"] = "attribute_matches" + model_config = ConfigDict(extra="forbid", title="Assert Attribute Matches (Relaxed)") + that: Literal["attribute_matches"] = Field("attribute_matches", title="That") element_text_path_description = """The Python xpath-like expression to find the target element.""" @@ -1127,18 +1280,22 @@ element_text_negate_description = """A boolean that can be set to true to negate class base_element_text_model(AssertionModel): """base model for element_text describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_element_text_model") + path: str = Field( ..., + title="Path", description=element_text_path_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=element_text_negate_description, ) - children: typing.Optional["assertion_list"] = None - asserts: typing.Optional["assertion_list"] = None + children: typing.Optional["assertion_list"] = Field(None, title="Children") + asserts: typing.Optional["assertion_list"] = Field(None, title="Asserts") @model_validator(mode="before") @classmethod @@ -1151,18 +1308,22 @@ class base_element_text_model(AssertionModel): class base_element_text_model_relaxed(AssertionModel): """base model for element_text describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_element_text_model_relaxed") + path: str = Field( ..., + title="Path", description=element_text_path_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=element_text_negate_description, ) - children: typing.Optional["assertion_list"] = None - asserts: typing.Optional["assertion_list"] = None + children: typing.Optional["assertion_list"] = Field(None, title="Children") + asserts: typing.Optional["assertion_list"] = Field(None, title="Asserts") @model_validator(mode="before") @classmethod @@ -1188,13 +1349,15 @@ class element_text_model(base_element_text_model): The sub-assertions, which have their own ``negate`` attribute, are not affected by ``negate``.""" - that: Literal["element_text"] = "element_text" + model_config = ConfigDict(extra="forbid", title="Assert Element Text") + that: Literal["element_text"] = Field("element_text", title="That") class element_text_model_nested(AssertionModel): r"""Nested version of this assertion model.""" - element_text: base_element_text_model + model_config = ConfigDict(extra="forbid", title="Assert Element Text (Nested)") + element_text: base_element_text_model = Field(..., title="Assert Element Text") class element_text_model_relaxed(base_element_text_model_relaxed): @@ -1213,7 +1376,8 @@ class element_text_model_relaxed(base_element_text_model_relaxed): The sub-assertions, which have their own ``negate`` attribute, are not affected by ``negate``.""" - that: Literal["element_text"] = "element_text" + model_config = ConfigDict(extra="forbid", title="Assert Element Text (Relaxed)") + that: Literal["element_text"] = Field("element_text", title="That") element_text_is_path_description = """The Python xpath-like expression to find the target element.""" @@ -1228,18 +1392,23 @@ element_text_is_negate_description = """A boolean that can be set to true to neg class base_element_text_is_model(AssertionModel): """base model for element_text_is describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_element_text_is_model") + path: str = Field( ..., + title="Path", description=element_text_is_path_description, ) text: str = Field( ..., + title="Text", description=element_text_is_text_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=element_text_is_negate_description, ) @@ -1247,18 +1416,23 @@ class base_element_text_is_model(AssertionModel): class base_element_text_is_model_relaxed(AssertionModel): """base model for element_text_is describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_element_text_is_model_relaxed") + path: str = Field( ..., + title="Path", description=element_text_is_path_description, ) text: str = Field( ..., + title="Text", description=element_text_is_text_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=element_text_is_negate_description, ) @@ -1277,13 +1451,15 @@ class element_text_is_model(base_element_text_is_model): With ``negate`` the result of the assertion (on the equality) can be inverted (the implicit assertion on the existence of the path is not affected).""" - that: Literal["element_text_is"] = "element_text_is" + model_config = ConfigDict(extra="forbid", title="Assert Element Text Is") + that: Literal["element_text_is"] = Field("element_text_is", title="That") class element_text_is_model_nested(AssertionModel): r"""Nested version of this assertion model.""" - element_text_is: base_element_text_is_model + model_config = ConfigDict(extra="forbid", title="Assert Element Text Is (Nested)") + element_text_is: base_element_text_is_model = Field(..., title="Assert Element Text Is") class element_text_is_model_relaxed(base_element_text_is_model_relaxed): @@ -1300,7 +1476,8 @@ class element_text_is_model_relaxed(base_element_text_is_model_relaxed): With ``negate`` the result of the assertion (on the equality) can be inverted (the implicit assertion on the existence of the path is not affected).""" - that: Literal["element_text_is"] = "element_text_is" + model_config = ConfigDict(extra="forbid", title="Assert Element Text Is (Relaxed)") + that: Literal["element_text_is"] = Field("element_text_is", title="That") element_text_matches_path_description = """The Python xpath-like expression to find the target element.""" @@ -1315,18 +1492,23 @@ element_text_matches_negate_description = ( class base_element_text_matches_model(AssertionModel): """base model for element_text_matches describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_element_text_matches_model") + path: str = Field( ..., + title="Path", description=element_text_matches_path_description, ) expression: Annotated[str, BeforeValidator(check_regex)] = Field( ..., + title="Expression", description=element_text_matches_expression_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=element_text_matches_negate_description, ) @@ -1334,18 +1516,23 @@ class base_element_text_matches_model(AssertionModel): class base_element_text_matches_model_relaxed(AssertionModel): """base model for element_text_matches describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_element_text_matches_model_relaxed") + path: str = Field( ..., + title="Path", description=element_text_matches_path_description, ) expression: Annotated[str, BeforeValidator(check_regex)] = Field( ..., + title="Expression", description=element_text_matches_expression_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=element_text_matches_negate_description, ) @@ -1364,13 +1551,15 @@ class element_text_matches_model(base_element_text_matches_model): With ``negate`` the result of the assertion (on the matching) can be inverted (the implicit assertion on the existence of the path is not affected).""" - that: Literal["element_text_matches"] = "element_text_matches" + model_config = ConfigDict(extra="forbid", title="Assert Element Text Matches") + that: Literal["element_text_matches"] = Field("element_text_matches", title="That") class element_text_matches_model_nested(AssertionModel): r"""Nested version of this assertion model.""" - element_text_matches: base_element_text_matches_model + model_config = ConfigDict(extra="forbid", title="Assert Element Text Matches (Nested)") + element_text_matches: base_element_text_matches_model = Field(..., title="Assert Element Text Matches") class element_text_matches_model_relaxed(base_element_text_matches_model_relaxed): @@ -1387,7 +1576,8 @@ class element_text_matches_model_relaxed(base_element_text_matches_model_relaxed With ``negate`` the result of the assertion (on the matching) can be inverted (the implicit assertion on the existence of the path is not affected).""" - that: Literal["element_text_matches"] = "element_text_matches" + model_config = ConfigDict(extra="forbid", title="Assert Element Text Matches (Relaxed)") + that: Literal["element_text_matches"] = Field("element_text_matches", title="That") has_element_with_path_path_description = """The Python xpath-like expression to find the target element.""" @@ -1400,13 +1590,17 @@ has_element_with_path_negate_description = ( class base_has_element_with_path_model(AssertionModel): """base model for has_element_with_path describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_element_with_path_model") + path: str = Field( ..., + title="Path", description=has_element_with_path_path_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=has_element_with_path_negate_description, ) @@ -1414,13 +1608,17 @@ class base_has_element_with_path_model(AssertionModel): class base_has_element_with_path_model_relaxed(AssertionModel): """base model for has_element_with_path describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_element_with_path_model_relaxed") + path: str = Field( ..., + title="Path", description=has_element_with_path_path_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=has_element_with_path_negate_description, ) @@ -1435,13 +1633,15 @@ class has_element_with_path_model(base_has_element_with_path_model): With ``negate`` the result of the assertion can be inverted.""" - that: Literal["has_element_with_path"] = "has_element_with_path" + model_config = ConfigDict(extra="forbid", title="Assert Has Element With Path") + that: Literal["has_element_with_path"] = Field("has_element_with_path", title="That") class has_element_with_path_model_nested(AssertionModel): r"""Nested version of this assertion model.""" - has_element_with_path: base_has_element_with_path_model + model_config = ConfigDict(extra="forbid", title="Assert Has Element With Path (Nested)") + has_element_with_path: base_has_element_with_path_model = Field(..., title="Assert Has Element With Path") class has_element_with_path_model_relaxed(base_has_element_with_path_model_relaxed): @@ -1454,7 +1654,8 @@ class has_element_with_path_model_relaxed(base_has_element_with_path_model_relax With ``negate`` the result of the assertion can be inverted.""" - that: Literal["has_element_with_path"] = "has_element_with_path" + model_config = ConfigDict(extra="forbid", title="Assert Has Element With Path (Relaxed)") + that: Literal["has_element_with_path"] = Field("has_element_with_path", title="That") has_n_elements_with_path_path_description = """The Python xpath-like expression to find the target element.""" @@ -1481,8 +1682,11 @@ has_n_elements_with_path_negate_description = ( class base_has_n_elements_with_path_model(AssertionModel): """base model for has_n_elements_with_path describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_n_elements_with_path_model") + path: str = Field( ..., + title="Path", description=has_n_elements_with_path_path_description, ) @@ -1492,6 +1696,7 @@ class base_has_n_elements_with_path_model(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="N", description=has_n_elements_with_path_n_description, ) @@ -1499,6 +1704,7 @@ class base_has_n_elements_with_path_model(AssertionModel): typing.Union[int, str], BeforeValidator(check_bytes), BeforeValidator(check_non_negative_if_int) ] = Field( 0, + title="Delta", description=has_n_elements_with_path_delta_description, ) @@ -1508,6 +1714,7 @@ class base_has_n_elements_with_path_model(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Min", description=has_n_elements_with_path_min_description, ) @@ -1517,11 +1724,13 @@ class base_has_n_elements_with_path_model(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Max", description=has_n_elements_with_path_max_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=has_n_elements_with_path_negate_description, ) @@ -1529,8 +1738,11 @@ class base_has_n_elements_with_path_model(AssertionModel): class base_has_n_elements_with_path_model_relaxed(AssertionModel): """base model for has_n_elements_with_path describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_n_elements_with_path_model_relaxed") + path: str = Field( ..., + title="Path", description=has_n_elements_with_path_path_description, ) @@ -1540,6 +1752,7 @@ class base_has_n_elements_with_path_model_relaxed(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="N", description=has_n_elements_with_path_n_description, ) @@ -1547,6 +1760,7 @@ class base_has_n_elements_with_path_model_relaxed(AssertionModel): typing.Union[int, str], BeforeValidator(check_bytes), BeforeValidator(check_non_negative_if_int) ] = Field( 0, + title="Delta", description=has_n_elements_with_path_delta_description, ) @@ -1556,6 +1770,7 @@ class base_has_n_elements_with_path_model_relaxed(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Min", description=has_n_elements_with_path_min_description, ) @@ -1565,11 +1780,13 @@ class base_has_n_elements_with_path_model_relaxed(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Max", description=has_n_elements_with_path_max_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=has_n_elements_with_path_negate_description, ) @@ -1585,16 +1802,18 @@ class has_n_elements_with_path_model(base_has_n_elements_with_path_model): ``` Alternatively to ``n`` and ``delta`` also the ``min`` and ``max`` attributes - can be used to specify the range of the expected number of occurrences. + can be used to specify the range of the expected number of occurences. With ``negate`` the result of the assertion can be inverted.""" - that: Literal["has_n_elements_with_path"] = "has_n_elements_with_path" + model_config = ConfigDict(extra="forbid", title="Assert Has N Elements With Path") + that: Literal["has_n_elements_with_path"] = Field("has_n_elements_with_path", title="That") class has_n_elements_with_path_model_nested(AssertionModel): r"""Nested version of this assertion model.""" - has_n_elements_with_path: base_has_n_elements_with_path_model + model_config = ConfigDict(extra="forbid", title="Assert Has N Elements With Path (Nested)") + has_n_elements_with_path: base_has_n_elements_with_path_model = Field(..., title="Assert Has N Elements With Path") class has_n_elements_with_path_model_relaxed(base_has_n_elements_with_path_model_relaxed): @@ -1608,36 +1827,44 @@ class has_n_elements_with_path_model_relaxed(base_has_n_elements_with_path_model ``` Alternatively to ``n`` and ``delta`` also the ``min`` and ``max`` attributes - can be used to specify the range of the expected number of occurrences. + can be used to specify the range of the expected number of occurences. With ``negate`` the result of the assertion can be inverted.""" - that: Literal["has_n_elements_with_path"] = "has_n_elements_with_path" + model_config = ConfigDict(extra="forbid", title="Assert Has N Elements With Path (Relaxed)") + that: Literal["has_n_elements_with_path"] = Field("has_n_elements_with_path", title="That") class base_is_valid_xml_model(AssertionModel): """base model for is_valid_xml describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_is_valid_xml_model") + class base_is_valid_xml_model_relaxed(AssertionModel): """base model for is_valid_xml describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_is_valid_xml_model_relaxed") + class is_valid_xml_model(base_is_valid_xml_model): r"""Asserts the output is a valid XML file (e.g. ````).""" - that: Literal["is_valid_xml"] = "is_valid_xml" + model_config = ConfigDict(extra="forbid", title="Assert Is Valid Xml") + that: Literal["is_valid_xml"] = Field("is_valid_xml", title="That") class is_valid_xml_model_nested(AssertionModel): r"""Nested version of this assertion model.""" - is_valid_xml: base_is_valid_xml_model + model_config = ConfigDict(extra="forbid", title="Assert Is Valid Xml (Nested)") + is_valid_xml: base_is_valid_xml_model = Field(..., title="Assert Is Valid Xml") class is_valid_xml_model_relaxed(base_is_valid_xml_model_relaxed): r"""Asserts the output is a valid XML file (e.g. ````).""" - that: Literal["is_valid_xml"] = "is_valid_xml" + model_config = ConfigDict(extra="forbid", title="Assert Is Valid Xml (Relaxed)") + that: Literal["is_valid_xml"] = Field("is_valid_xml", title="That") xml_element_path_description = """The Python xpath-like expression to find the target element.""" @@ -1664,18 +1891,23 @@ xml_element_negate_description = """A boolean that can be set to true to negate class base_xml_element_model(AssertionModel): """base model for xml_element describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_xml_element_model") + path: str = Field( ..., + title="Path", description=xml_element_path_description, ) attribute: typing.Optional[typing.Union[str]] = Field( None, + title="Attribute", description=xml_element_attribute_description, ) all: typing.Union[bool, str] = Field( False, + title="All", description=xml_element_all_description, ) @@ -1685,6 +1917,7 @@ class base_xml_element_model(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="N", description=xml_element_n_description, ) @@ -1692,6 +1925,7 @@ class base_xml_element_model(AssertionModel): typing.Union[int, str], BeforeValidator(check_bytes), BeforeValidator(check_non_negative_if_int) ] = Field( 0, + title="Delta", description=xml_element_delta_description, ) @@ -1701,6 +1935,7 @@ class base_xml_element_model(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Min", description=xml_element_min_description, ) @@ -1710,33 +1945,40 @@ class base_xml_element_model(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Max", description=xml_element_max_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=xml_element_negate_description, ) - children: typing.Optional["assertion_list"] = None - asserts: typing.Optional["assertion_list"] = None + children: typing.Optional["assertion_list"] = Field(None, title="Children") + asserts: typing.Optional["assertion_list"] = Field(None, title="Asserts") class base_xml_element_model_relaxed(AssertionModel): """base model for xml_element describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_xml_element_model_relaxed") + path: str = Field( ..., + title="Path", description=xml_element_path_description, ) attribute: typing.Optional[typing.Union[str]] = Field( None, + title="Attribute", description=xml_element_attribute_description, ) all: typing.Union[bool, str] = Field( False, + title="All", description=xml_element_all_description, ) @@ -1746,6 +1988,7 @@ class base_xml_element_model_relaxed(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="N", description=xml_element_n_description, ) @@ -1753,6 +1996,7 @@ class base_xml_element_model_relaxed(AssertionModel): typing.Union[int, str], BeforeValidator(check_bytes), BeforeValidator(check_non_negative_if_int) ] = Field( 0, + title="Delta", description=xml_element_delta_description, ) @@ -1762,6 +2006,7 @@ class base_xml_element_model_relaxed(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Min", description=xml_element_min_description, ) @@ -1771,22 +2016,24 @@ class base_xml_element_model_relaxed(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Max", description=xml_element_max_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=xml_element_negate_description, ) - children: typing.Optional["assertion_list"] = None - asserts: typing.Optional["assertion_list"] = None + children: typing.Optional["assertion_list"] = Field(None, title="Children") + asserts: typing.Optional["assertion_list"] = Field(None, title="Asserts") class xml_element_model(base_xml_element_model): r"""Assert if the XML file contains element(s) or tag(s) with the specified [XPath-like ``path``](https://lxml.de/xpathxslt.html). If ``n`` and ``delta`` - or ``min`` and ``max`` are given also the number of occurrences is checked. + or ``min`` and ``max`` are given also the number of occurences is checked. ```xml @@ -1796,7 +2043,7 @@ class xml_element_model(base_xml_element_model): ``` - With ``negate="true"`` the outcome of the assertions wrt the presence and number + With ``negate="true"`` the outcome of the assertions wrt the precence and number of ``path`` can be negated. If there are any sub assertions then check them against - the content of the attribute ``attribute`` @@ -1811,24 +2058,26 @@ class xml_element_model(base_xml_element_model): ``` Sub-assertions are not subject to the ``negate`` attribute of ``xml_element``. - If ``all`` is ``true`` then the sub assertions are checked for all occurrences. + If ``all`` is ``true`` then the sub assertions are checked for all occurences. Note that all other XML assertions can be expressed by this assertion (Galaxy also implements the other assertions by calling this one).""" - that: Literal["xml_element"] = "xml_element" + model_config = ConfigDict(extra="forbid", title="Assert Xml Element") + that: Literal["xml_element"] = Field("xml_element", title="That") class xml_element_model_nested(AssertionModel): r"""Nested version of this assertion model.""" - xml_element: base_xml_element_model + model_config = ConfigDict(extra="forbid", title="Assert Xml Element (Nested)") + xml_element: base_xml_element_model = Field(..., title="Assert Xml Element") class xml_element_model_relaxed(base_xml_element_model_relaxed): r"""Assert if the XML file contains element(s) or tag(s) with the specified [XPath-like ``path``](https://lxml.de/xpathxslt.html). If ``n`` and ``delta`` - or ``min`` and ``max`` are given also the number of occurrences is checked. + or ``min`` and ``max`` are given also the number of occurences is checked. ```xml @@ -1838,7 +2087,7 @@ class xml_element_model_relaxed(base_xml_element_model_relaxed): ``` - With ``negate="true"`` the outcome of the assertions wrt the presence and number + With ``negate="true"`` the outcome of the assertions wrt the precence and number of ``path`` can be negated. If there are any sub assertions then check them against - the content of the attribute ``attribute`` @@ -1853,12 +2102,13 @@ class xml_element_model_relaxed(base_xml_element_model_relaxed): ``` Sub-assertions are not subject to the ``negate`` attribute of ``xml_element``. - If ``all`` is ``true`` then the sub assertions are checked for all occurrences. + If ``all`` is ``true`` then the sub assertions are checked for all occurences. Note that all other XML assertions can be expressed by this assertion (Galaxy also implements the other assertions by calling this one).""" - that: Literal["xml_element"] = "xml_element" + model_config = ConfigDict(extra="forbid", title="Assert Xml Element (Relaxed)") + that: Literal["xml_element"] = Field("xml_element", title="That") has_json_property_with_text_property_description = """The property name to search the JSON document for.""" @@ -1869,13 +2119,17 @@ has_json_property_with_text_text_description = """The expected text value of the class base_has_json_property_with_text_model(AssertionModel): """base model for has_json_property_with_text describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_json_property_with_text_model") + property: str = Field( ..., + title="Property", description=has_json_property_with_text_property_description, ) text: str = Field( ..., + title="Text", description=has_json_property_with_text_text_description, ) @@ -1883,13 +2137,17 @@ class base_has_json_property_with_text_model(AssertionModel): class base_has_json_property_with_text_model_relaxed(AssertionModel): """base model for has_json_property_with_text describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_json_property_with_text_model_relaxed") + property: str = Field( ..., + title="Property", description=has_json_property_with_text_property_description, ) text: str = Field( ..., + title="Text", description=has_json_property_with_text_text_description, ) @@ -1901,13 +2159,17 @@ class has_json_property_with_text_model(base_has_json_property_with_text_model): ```""" - that: Literal["has_json_property_with_text"] = "has_json_property_with_text" + model_config = ConfigDict(extra="forbid", title="Assert Has Json Property With Text") + that: Literal["has_json_property_with_text"] = Field("has_json_property_with_text", title="That") class has_json_property_with_text_model_nested(AssertionModel): r"""Nested version of this assertion model.""" - has_json_property_with_text: base_has_json_property_with_text_model + model_config = ConfigDict(extra="forbid", title="Assert Has Json Property With Text (Nested)") + has_json_property_with_text: base_has_json_property_with_text_model = Field( + ..., title="Assert Has Json Property With Text" + ) class has_json_property_with_text_model_relaxed(base_has_json_property_with_text_model_relaxed): @@ -1917,7 +2179,8 @@ class has_json_property_with_text_model_relaxed(base_has_json_property_with_text ```""" - that: Literal["has_json_property_with_text"] = "has_json_property_with_text" + model_config = ConfigDict(extra="forbid", title="Assert Has Json Property With Text (Relaxed)") + that: Literal["has_json_property_with_text"] = Field("has_json_property_with_text", title="That") has_json_property_with_value_property_description = """The property name to search the JSON document for.""" @@ -1930,13 +2193,17 @@ has_json_property_with_value_value_description = ( class base_has_json_property_with_value_model(AssertionModel): """base model for has_json_property_with_value describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_json_property_with_value_model") + property: str = Field( ..., + title="Property", description=has_json_property_with_value_property_description, ) value: str = Field( ..., + title="Value", description=has_json_property_with_value_value_description, ) @@ -1944,13 +2211,17 @@ class base_has_json_property_with_value_model(AssertionModel): class base_has_json_property_with_value_model_relaxed(AssertionModel): """base model for has_json_property_with_value describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_json_property_with_value_model_relaxed") + property: str = Field( ..., + title="Property", description=has_json_property_with_value_property_description, ) value: str = Field( ..., + title="Value", description=has_json_property_with_value_value_description, ) @@ -1962,13 +2233,17 @@ class has_json_property_with_value_model(base_has_json_property_with_value_model ```""" - that: Literal["has_json_property_with_value"] = "has_json_property_with_value" + model_config = ConfigDict(extra="forbid", title="Assert Has Json Property With Value") + that: Literal["has_json_property_with_value"] = Field("has_json_property_with_value", title="That") class has_json_property_with_value_model_nested(AssertionModel): r"""Nested version of this assertion model.""" - has_json_property_with_value: base_has_json_property_with_value_model + model_config = ConfigDict(extra="forbid", title="Assert Has Json Property With Value (Nested)") + has_json_property_with_value: base_has_json_property_with_value_model = Field( + ..., title="Assert Has Json Property With Value" + ) class has_json_property_with_value_model_relaxed(base_has_json_property_with_value_model_relaxed): @@ -1978,7 +2253,8 @@ class has_json_property_with_value_model_relaxed(base_has_json_property_with_val ```""" - that: Literal["has_json_property_with_value"] = "has_json_property_with_value" + model_config = ConfigDict(extra="forbid", title="Assert Has Json Property With Value (Relaxed)") + that: Literal["has_json_property_with_value"] = Field("has_json_property_with_value", title="That") has_h5_attribute_key_description = """HDF5 attribute to check value of.""" @@ -1989,13 +2265,17 @@ has_h5_attribute_value_description = """Expected value of HDF5 attribute to chec class base_has_h5_attribute_model(AssertionModel): """base model for has_h5_attribute describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_h5_attribute_model") + key: str = Field( ..., + title="Key", description=has_h5_attribute_key_description, ) value: str = Field( ..., + title="Value", description=has_h5_attribute_value_description, ) @@ -2003,13 +2283,17 @@ class base_has_h5_attribute_model(AssertionModel): class base_has_h5_attribute_model_relaxed(AssertionModel): """base model for has_h5_attribute describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_h5_attribute_model_relaxed") + key: str = Field( ..., + title="Key", description=has_h5_attribute_key_description, ) value: str = Field( ..., + title="Value", description=has_h5_attribute_value_description, ) @@ -2021,13 +2305,15 @@ class has_h5_attribute_model(base_has_h5_attribute_model): ```""" - that: Literal["has_h5_attribute"] = "has_h5_attribute" + model_config = ConfigDict(extra="forbid", title="Assert Has H5 Attribute") + that: Literal["has_h5_attribute"] = Field("has_h5_attribute", title="That") class has_h5_attribute_model_nested(AssertionModel): r"""Nested version of this assertion model.""" - has_h5_attribute: base_has_h5_attribute_model + model_config = ConfigDict(extra="forbid", title="Assert Has H5 Attribute (Nested)") + has_h5_attribute: base_has_h5_attribute_model = Field(..., title="Assert Has H5 Attribute") class has_h5_attribute_model_relaxed(base_has_h5_attribute_model_relaxed): @@ -2037,7 +2323,8 @@ class has_h5_attribute_model_relaxed(base_has_h5_attribute_model_relaxed): ```""" - that: Literal["has_h5_attribute"] = "has_h5_attribute" + model_config = ConfigDict(extra="forbid", title="Assert Has H5 Attribute (Relaxed)") + that: Literal["has_h5_attribute"] = Field("has_h5_attribute", title="That") has_h5_keys_keys_description = """HDF5 attributes to check value of as a comma-separated string.""" @@ -2046,8 +2333,11 @@ has_h5_keys_keys_description = """HDF5 attributes to check value of as a comma-s class base_has_h5_keys_model(AssertionModel): """base model for has_h5_keys describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_h5_keys_model") + keys: str = Field( ..., + title="Keys", description=has_h5_keys_keys_description, ) @@ -2055,8 +2345,11 @@ class base_has_h5_keys_model(AssertionModel): class base_has_h5_keys_model_relaxed(AssertionModel): """base model for has_h5_keys describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_h5_keys_model_relaxed") + keys: str = Field( ..., + title="Keys", description=has_h5_keys_keys_description, ) @@ -2064,19 +2357,22 @@ class base_has_h5_keys_model_relaxed(AssertionModel): class has_h5_keys_model(base_has_h5_keys_model): r"""Asserts the specified HDF5 output has the given keys.""" - that: Literal["has_h5_keys"] = "has_h5_keys" + model_config = ConfigDict(extra="forbid", title="Assert Has H5 Keys") + that: Literal["has_h5_keys"] = Field("has_h5_keys", title="That") class has_h5_keys_model_nested(AssertionModel): r"""Nested version of this assertion model.""" - has_h5_keys: base_has_h5_keys_model + model_config = ConfigDict(extra="forbid", title="Assert Has H5 Keys (Nested)") + has_h5_keys: base_has_h5_keys_model = Field(..., title="Assert Has H5 Keys") class has_h5_keys_model_relaxed(base_has_h5_keys_model_relaxed): r"""Asserts the specified HDF5 output has the given keys.""" - that: Literal["has_h5_keys"] = "has_h5_keys" + model_config = ConfigDict(extra="forbid", title="Assert Has H5 Keys (Relaxed)") + that: Literal["has_h5_keys"] = Field("has_h5_keys", title="That") has_archive_member_path_description = """The regular expression specifying the archive member.""" @@ -2101,13 +2397,17 @@ has_archive_member_negate_description = """A boolean that can be set to true to class base_has_archive_member_model(AssertionModel): """base model for has_archive_member describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_archive_member_model") + path: str = Field( ..., + title="Path", description=has_archive_member_path_description, ) all: typing.Union[bool, str] = Field( False, + title="All", description=has_archive_member_all_description, ) @@ -2117,6 +2417,7 @@ class base_has_archive_member_model(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="N", description=has_archive_member_n_description, ) @@ -2124,6 +2425,7 @@ class base_has_archive_member_model(AssertionModel): typing.Union[int, str], BeforeValidator(check_bytes), BeforeValidator(check_non_negative_if_int) ] = Field( 0, + title="Delta", description=has_archive_member_delta_description, ) @@ -2133,6 +2435,7 @@ class base_has_archive_member_model(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Min", description=has_archive_member_min_description, ) @@ -2142,28 +2445,34 @@ class base_has_archive_member_model(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Max", description=has_archive_member_max_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=has_archive_member_negate_description, ) - children: typing.Optional["assertion_list"] = None - asserts: typing.Optional["assertion_list"] = None + children: typing.Optional["assertion_list"] = Field(None, title="Children") + asserts: typing.Optional["assertion_list"] = Field(None, title="Asserts") class base_has_archive_member_model_relaxed(AssertionModel): """base model for has_archive_member describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_archive_member_model_relaxed") + path: str = Field( ..., + title="Path", description=has_archive_member_path_description, ) all: typing.Union[bool, str] = Field( False, + title="All", description=has_archive_member_all_description, ) @@ -2173,6 +2482,7 @@ class base_has_archive_member_model_relaxed(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="N", description=has_archive_member_n_description, ) @@ -2180,6 +2490,7 @@ class base_has_archive_member_model_relaxed(AssertionModel): typing.Union[int, str], BeforeValidator(check_bytes), BeforeValidator(check_non_negative_if_int) ] = Field( 0, + title="Delta", description=has_archive_member_delta_description, ) @@ -2189,6 +2500,7 @@ class base_has_archive_member_model_relaxed(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Min", description=has_archive_member_min_description, ) @@ -2198,16 +2510,18 @@ class base_has_archive_member_model_relaxed(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Max", description=has_archive_member_max_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=has_archive_member_negate_description, ) - children: typing.Optional["assertion_list"] = None - asserts: typing.Optional["assertion_list"] = None + children: typing.Optional["assertion_list"] = Field(None, title="Children") + asserts: typing.Optional["assertion_list"] = Field(None, title="Asserts") class has_archive_member_model(base_has_archive_member_model): @@ -2256,13 +2570,15 @@ class has_archive_member_model(base_has_archive_member_model): check if the file is an archive at all, which is also done by the function, is not affected.""" - that: Literal["has_archive_member"] = "has_archive_member" + model_config = ConfigDict(extra="forbid", title="Assert Has Archive Member") + that: Literal["has_archive_member"] = Field("has_archive_member", title="That") class has_archive_member_model_nested(AssertionModel): r"""Nested version of this assertion model.""" - has_archive_member: base_has_archive_member_model + model_config = ConfigDict(extra="forbid", title="Assert Has Archive Member (Nested)") + has_archive_member: base_has_archive_member_model = Field(..., title="Assert Has Archive Member") class has_archive_member_model_relaxed(base_has_archive_member_model_relaxed): @@ -2311,7 +2627,8 @@ class has_archive_member_model_relaxed(base_has_archive_member_model_relaxed): check if the file is an archive at all, which is also done by the function, is not affected.""" - that: Literal["has_archive_member"] = "has_archive_member" + model_config = ConfigDict(extra="forbid", title="Assert Has Archive Member (Relaxed)") + that: Literal["has_archive_member"] = Field("has_archive_member", title="That") has_size_value_description = """Deprecated alias for `size`""" @@ -2332,12 +2649,15 @@ has_size_negate_description = """A boolean that can be set to true to negate the class base_has_size_model(AssertionModel): """base model for has_size describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_size_model") + value: Annotated[ typing.Optional[typing.Union[str, int]], BeforeValidator(check_bytes), BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Value", description=has_size_value_description, ) @@ -2347,6 +2667,7 @@ class base_has_size_model(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Size", description=has_size_size_description, ) @@ -2354,6 +2675,7 @@ class base_has_size_model(AssertionModel): typing.Union[int, str], BeforeValidator(check_bytes), BeforeValidator(check_non_negative_if_int) ] = Field( 0, + title="Delta", description=has_size_delta_description, ) @@ -2363,6 +2685,7 @@ class base_has_size_model(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Min", description=has_size_min_description, ) @@ -2372,11 +2695,13 @@ class base_has_size_model(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Max", description=has_size_max_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=has_size_negate_description, ) @@ -2384,12 +2709,15 @@ class base_has_size_model(AssertionModel): class base_has_size_model_relaxed(AssertionModel): """base model for has_size describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_size_model_relaxed") + value: Annotated[ typing.Optional[typing.Union[str, int]], BeforeValidator(check_bytes), BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Value", description=has_size_value_description, ) @@ -2399,6 +2727,7 @@ class base_has_size_model_relaxed(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Size", description=has_size_size_description, ) @@ -2406,6 +2735,7 @@ class base_has_size_model_relaxed(AssertionModel): typing.Union[int, str], BeforeValidator(check_bytes), BeforeValidator(check_non_negative_if_int) ] = Field( 0, + title="Delta", description=has_size_delta_description, ) @@ -2415,6 +2745,7 @@ class base_has_size_model_relaxed(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Min", description=has_size_min_description, ) @@ -2424,11 +2755,13 @@ class base_has_size_model_relaxed(AssertionModel): BeforeValidator(check_non_negative_if_int), ] = Field( None, + title="Max", description=has_size_max_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=has_size_negate_description, ) @@ -2439,13 +2772,15 @@ class has_size_model(base_has_size_model): Attributes size and value or synonyms though value is considered deprecated. The size optionally allows for absolute (``delta``) difference.""" - that: Literal["has_size"] = "has_size" + model_config = ConfigDict(extra="forbid", title="Assert Has Size") + that: Literal["has_size"] = Field("has_size", title="That") class has_size_model_nested(AssertionModel): r"""Nested version of this assertion model.""" - has_size: base_has_size_model + model_config = ConfigDict(extra="forbid", title="Assert Has Size (Nested)") + has_size: base_has_size_model = Field(..., title="Assert Has Size") class has_size_model_relaxed(base_has_size_model_relaxed): @@ -2454,7 +2789,8 @@ class has_size_model_relaxed(base_has_size_model_relaxed): Attributes size and value or synonyms though value is considered deprecated. The size optionally allows for absolute (``delta``) difference.""" - that: Literal["has_size"] = "has_size" + model_config = ConfigDict(extra="forbid", title="Assert Has Size (Relaxed)") + that: Literal["has_size"] = Field("has_size", title="That") has_image_center_of_mass_center_of_mass_description = """The required center of mass of the image intensities (horizontal and vertical coordinate, separated by a comma).""" @@ -2475,28 +2811,35 @@ has_image_center_of_mass_eps_description = ( class base_has_image_center_of_mass_model(AssertionModel): """base model for has_image_center_of_mass describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_image_center_of_mass_model") + center_of_mass: Annotated[str, BeforeValidator(check_center_of_mass)] = Field( ..., + title="Center Of Mass", description=has_image_center_of_mass_center_of_mass_description, ) channel: typing.Optional[StrictInt] = Field( None, + title="Channel", description=has_image_center_of_mass_channel_description, ) slice: typing.Optional[StrictInt] = Field( None, + title="Slice", description=has_image_center_of_mass_slice_description, ) frame: typing.Optional[StrictInt] = Field( None, + title="Frame", description=has_image_center_of_mass_frame_description, ) eps: Annotated[typing.Union[StrictInt, StrictFloat], BeforeValidator(check_non_negative_if_set)] = Field( 0.01, + title="Eps", description=has_image_center_of_mass_eps_description, ) @@ -2504,28 +2847,35 @@ class base_has_image_center_of_mass_model(AssertionModel): class base_has_image_center_of_mass_model_relaxed(AssertionModel): """base model for has_image_center_of_mass describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_image_center_of_mass_model_relaxed") + center_of_mass: Annotated[str, BeforeValidator(check_center_of_mass)] = Field( ..., + title="Center Of Mass", description=has_image_center_of_mass_center_of_mass_description, ) channel: typing.Optional[typing.Union[str, int]] = Field( None, + title="Channel", description=has_image_center_of_mass_channel_description, ) slice: typing.Optional[typing.Union[str, int]] = Field( None, + title="Slice", description=has_image_center_of_mass_slice_description, ) frame: typing.Optional[typing.Union[str, int]] = Field( None, + title="Frame", description=has_image_center_of_mass_frame_description, ) eps: Annotated[typing.Union[float, str], BeforeValidator(check_non_negative_if_set)] = Field( 0.01, + title="Eps", description=has_image_center_of_mass_eps_description, ) @@ -2537,13 +2887,15 @@ class has_image_center_of_mass_model(base_has_image_center_of_mass_model): or has an Euclidean distance of ``eps`` or less to that point (e.g., ````).""" - that: Literal["has_image_center_of_mass"] = "has_image_center_of_mass" + model_config = ConfigDict(extra="forbid", title="Assert Has Image Center Of Mass") + that: Literal["has_image_center_of_mass"] = Field("has_image_center_of_mass", title="That") class has_image_center_of_mass_model_nested(AssertionModel): r"""Nested version of this assertion model.""" - has_image_center_of_mass: base_has_image_center_of_mass_model + model_config = ConfigDict(extra="forbid", title="Assert Has Image Center Of Mass (Nested)") + has_image_center_of_mass: base_has_image_center_of_mass_model = Field(..., title="Assert Has Image Center Of Mass") class has_image_center_of_mass_model_relaxed(base_has_image_center_of_mass_model_relaxed): @@ -2553,7 +2905,8 @@ class has_image_center_of_mass_model_relaxed(base_has_image_center_of_mass_model or has an Euclidean distance of ``eps`` or less to that point (e.g., ````).""" - that: Literal["has_image_center_of_mass"] = "has_image_center_of_mass" + model_config = ConfigDict(extra="forbid", title="Assert Has Image Center Of Mass (Relaxed)") + that: Literal["has_image_center_of_mass"] = Field("has_image_center_of_mass", title="That") has_image_channels_channels_description = """Expected number of channels of the image.""" @@ -2570,28 +2923,35 @@ has_image_channels_negate_description = """A boolean that can be set to true to class base_has_image_channels_model(AssertionModel): """base model for has_image_channels describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_image_channels_model") + channels: Annotated[typing.Optional[StrictInt], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Channels", description=has_image_channels_channels_description, ) delta: Annotated[StrictInt, BeforeValidator(check_non_negative_if_set)] = Field( 0, + title="Delta", description=has_image_channels_delta_description, ) min: Annotated[typing.Optional[StrictInt], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Min", description=has_image_channels_min_description, ) max: Annotated[typing.Optional[StrictInt], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Max", description=has_image_channels_max_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=has_image_channels_negate_description, ) @@ -2599,28 +2959,35 @@ class base_has_image_channels_model(AssertionModel): class base_has_image_channels_model_relaxed(AssertionModel): """base model for has_image_channels describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_image_channels_model_relaxed") + channels: Annotated[typing.Optional[typing.Union[str, int]], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Channels", description=has_image_channels_channels_description, ) delta: Annotated[typing.Union[int, str], BeforeValidator(check_non_negative_if_set)] = Field( 0, + title="Delta", description=has_image_channels_delta_description, ) min: Annotated[typing.Optional[typing.Union[str, int]], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Min", description=has_image_channels_min_description, ) max: Annotated[typing.Optional[typing.Union[str, int]], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Max", description=has_image_channels_max_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=has_image_channels_negate_description, ) @@ -2632,13 +2999,15 @@ class has_image_channels_model(base_has_image_channels_model): Alternatively the range of the expected number of channels can be specified by ``min`` and/or ``max``.""" - that: Literal["has_image_channels"] = "has_image_channels" + model_config = ConfigDict(extra="forbid", title="Assert Has Image Channels") + that: Literal["has_image_channels"] = Field("has_image_channels", title="That") class has_image_channels_model_nested(AssertionModel): r"""Nested version of this assertion model.""" - has_image_channels: base_has_image_channels_model + model_config = ConfigDict(extra="forbid", title="Assert Has Image Channels (Nested)") + has_image_channels: base_has_image_channels_model = Field(..., title="Assert Has Image Channels") class has_image_channels_model_relaxed(base_has_image_channels_model_relaxed): @@ -2648,7 +3017,8 @@ class has_image_channels_model_relaxed(base_has_image_channels_model_relaxed): Alternatively the range of the expected number of channels can be specified by ``min`` and/or ``max``.""" - that: Literal["has_image_channels"] = "has_image_channels" + model_config = ConfigDict(extra="forbid", title="Assert Has Image Channels (Relaxed)") + that: Literal["has_image_channels"] = Field("has_image_channels", title="That") has_image_depth_depth_description = """Expected depth of the image (number of slices).""" @@ -2665,28 +3035,35 @@ has_image_depth_negate_description = """A boolean that can be set to true to neg class base_has_image_depth_model(AssertionModel): """base model for has_image_depth describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_image_depth_model") + depth: Annotated[typing.Optional[StrictInt], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Depth", description=has_image_depth_depth_description, ) delta: Annotated[StrictInt, BeforeValidator(check_non_negative_if_set)] = Field( 0, + title="Delta", description=has_image_depth_delta_description, ) min: Annotated[typing.Optional[StrictInt], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Min", description=has_image_depth_min_description, ) max: Annotated[typing.Optional[StrictInt], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Max", description=has_image_depth_max_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=has_image_depth_negate_description, ) @@ -2694,28 +3071,35 @@ class base_has_image_depth_model(AssertionModel): class base_has_image_depth_model_relaxed(AssertionModel): """base model for has_image_depth describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_image_depth_model_relaxed") + depth: Annotated[typing.Optional[typing.Union[str, int]], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Depth", description=has_image_depth_depth_description, ) delta: Annotated[typing.Union[int, str], BeforeValidator(check_non_negative_if_set)] = Field( 0, + title="Delta", description=has_image_depth_delta_description, ) min: Annotated[typing.Optional[typing.Union[str, int]], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Min", description=has_image_depth_min_description, ) max: Annotated[typing.Optional[typing.Union[str, int]], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Max", description=has_image_depth_max_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=has_image_depth_negate_description, ) @@ -2726,13 +3110,15 @@ class has_image_depth_model(base_has_image_depth_model): The depth is plus/minus ``delta`` (e.g., ````). Alternatively the range of the expected depth can be specified by ``min`` and/or ``max``.""" - that: Literal["has_image_depth"] = "has_image_depth" + model_config = ConfigDict(extra="forbid", title="Assert Has Image Depth") + that: Literal["has_image_depth"] = Field("has_image_depth", title="That") class has_image_depth_model_nested(AssertionModel): r"""Nested version of this assertion model.""" - has_image_depth: base_has_image_depth_model + model_config = ConfigDict(extra="forbid", title="Assert Has Image Depth (Nested)") + has_image_depth: base_has_image_depth_model = Field(..., title="Assert Has Image Depth") class has_image_depth_model_relaxed(base_has_image_depth_model_relaxed): @@ -2741,7 +3127,8 @@ class has_image_depth_model_relaxed(base_has_image_depth_model_relaxed): The depth is plus/minus ``delta`` (e.g., ````). Alternatively the range of the expected depth can be specified by ``min`` and/or ``max``.""" - that: Literal["has_image_depth"] = "has_image_depth" + model_config = ConfigDict(extra="forbid", title="Assert Has Image Depth (Relaxed)") + that: Literal["has_image_depth"] = Field("has_image_depth", title="That") has_image_frames_frames_description = """Expected number of frames in the image sequence (number of time steps).""" @@ -2758,28 +3145,35 @@ has_image_frames_negate_description = """A boolean that can be set to true to ne class base_has_image_frames_model(AssertionModel): """base model for has_image_frames describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_image_frames_model") + frames: Annotated[typing.Optional[StrictInt], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Frames", description=has_image_frames_frames_description, ) delta: Annotated[StrictInt, BeforeValidator(check_non_negative_if_set)] = Field( 0, + title="Delta", description=has_image_frames_delta_description, ) min: Annotated[typing.Optional[StrictInt], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Min", description=has_image_frames_min_description, ) max: Annotated[typing.Optional[StrictInt], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Max", description=has_image_frames_max_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=has_image_frames_negate_description, ) @@ -2787,28 +3181,35 @@ class base_has_image_frames_model(AssertionModel): class base_has_image_frames_model_relaxed(AssertionModel): """base model for has_image_frames describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_image_frames_model_relaxed") + frames: Annotated[typing.Optional[typing.Union[str, int]], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Frames", description=has_image_frames_frames_description, ) delta: Annotated[typing.Union[int, str], BeforeValidator(check_non_negative_if_set)] = Field( 0, + title="Delta", description=has_image_frames_delta_description, ) min: Annotated[typing.Optional[typing.Union[str, int]], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Min", description=has_image_frames_min_description, ) max: Annotated[typing.Optional[typing.Union[str, int]], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Max", description=has_image_frames_max_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=has_image_frames_negate_description, ) @@ -2819,13 +3220,15 @@ class has_image_frames_model(base_has_image_frames_model): The number of frames is plus/minus ``delta`` (e.g., ````). Alternatively the range of the expected number of frames can be specified by ``min`` and/or ``max``.""" - that: Literal["has_image_frames"] = "has_image_frames" + model_config = ConfigDict(extra="forbid", title="Assert Has Image Frames") + that: Literal["has_image_frames"] = Field("has_image_frames", title="That") class has_image_frames_model_nested(AssertionModel): r"""Nested version of this assertion model.""" - has_image_frames: base_has_image_frames_model + model_config = ConfigDict(extra="forbid", title="Assert Has Image Frames (Nested)") + has_image_frames: base_has_image_frames_model = Field(..., title="Assert Has Image Frames") class has_image_frames_model_relaxed(base_has_image_frames_model_relaxed): @@ -2834,7 +3237,8 @@ class has_image_frames_model_relaxed(base_has_image_frames_model_relaxed): The number of frames is plus/minus ``delta`` (e.g., ````). Alternatively the range of the expected number of frames can be specified by ``min`` and/or ``max``.""" - that: Literal["has_image_frames"] = "has_image_frames" + model_config = ConfigDict(extra="forbid", title="Assert Has Image Frames (Relaxed)") + that: Literal["has_image_frames"] = Field("has_image_frames", title="That") has_image_height_height_description = """Expected height of the image (in pixels).""" @@ -2851,28 +3255,35 @@ has_image_height_negate_description = """A boolean that can be set to true to ne class base_has_image_height_model(AssertionModel): """base model for has_image_height describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_image_height_model") + height: Annotated[typing.Optional[StrictInt], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Height", description=has_image_height_height_description, ) delta: Annotated[StrictInt, BeforeValidator(check_non_negative_if_set)] = Field( 0, + title="Delta", description=has_image_height_delta_description, ) min: Annotated[typing.Optional[StrictInt], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Min", description=has_image_height_min_description, ) max: Annotated[typing.Optional[StrictInt], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Max", description=has_image_height_max_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=has_image_height_negate_description, ) @@ -2880,28 +3291,35 @@ class base_has_image_height_model(AssertionModel): class base_has_image_height_model_relaxed(AssertionModel): """base model for has_image_height describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_image_height_model_relaxed") + height: Annotated[typing.Optional[typing.Union[str, int]], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Height", description=has_image_height_height_description, ) delta: Annotated[typing.Union[int, str], BeforeValidator(check_non_negative_if_set)] = Field( 0, + title="Delta", description=has_image_height_delta_description, ) min: Annotated[typing.Optional[typing.Union[str, int]], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Min", description=has_image_height_min_description, ) max: Annotated[typing.Optional[typing.Union[str, int]], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Max", description=has_image_height_max_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=has_image_height_negate_description, ) @@ -2912,13 +3330,15 @@ class has_image_height_model(base_has_image_height_model): The height is plus/minus ``delta`` (e.g., ````). Alternatively the range of the expected height can be specified by ``min`` and/or ``max``.""" - that: Literal["has_image_height"] = "has_image_height" + model_config = ConfigDict(extra="forbid", title="Assert Has Image Height") + that: Literal["has_image_height"] = Field("has_image_height", title="That") class has_image_height_model_nested(AssertionModel): r"""Nested version of this assertion model.""" - has_image_height: base_has_image_height_model + model_config = ConfigDict(extra="forbid", title="Assert Has Image Height (Nested)") + has_image_height: base_has_image_height_model = Field(..., title="Assert Has Image Height") class has_image_height_model_relaxed(base_has_image_height_model_relaxed): @@ -2927,7 +3347,8 @@ class has_image_height_model_relaxed(base_has_image_height_model_relaxed): The height is plus/minus ``delta`` (e.g., ````). Alternatively the range of the expected height can be specified by ``min`` and/or ``max``.""" - that: Literal["has_image_height"] = "has_image_height" + model_config = ConfigDict(extra="forbid", title="Assert Has Image Height (Relaxed)") + that: Literal["has_image_height"] = Field("has_image_height", title="That") has_image_mean_intensity_channel_description = """Restricts the assertion to a specific channel of the image (where ``0`` corresponds to the first image channel).""" @@ -2950,38 +3371,47 @@ has_image_mean_intensity_max_description = """An upper bound of the required mea class base_has_image_mean_intensity_model(AssertionModel): """base model for has_image_mean_intensity describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_image_mean_intensity_model") + channel: typing.Optional[StrictInt] = Field( None, + title="Channel", description=has_image_mean_intensity_channel_description, ) slice: typing.Optional[StrictInt] = Field( None, + title="Slice", description=has_image_mean_intensity_slice_description, ) frame: typing.Optional[StrictInt] = Field( None, + title="Frame", description=has_image_mean_intensity_frame_description, ) mean_intensity: typing.Optional[typing.Union[StrictInt, StrictFloat]] = Field( None, + title="Mean Intensity", description=has_image_mean_intensity_mean_intensity_description, ) eps: Annotated[typing.Union[StrictInt, StrictFloat], BeforeValidator(check_non_negative_if_set)] = Field( 0.01, + title="Eps", description=has_image_mean_intensity_eps_description, ) min: typing.Optional[typing.Union[StrictInt, StrictFloat]] = Field( None, + title="Min", description=has_image_mean_intensity_min_description, ) max: typing.Optional[typing.Union[StrictInt, StrictFloat]] = Field( None, + title="Max", description=has_image_mean_intensity_max_description, ) @@ -2989,38 +3419,47 @@ class base_has_image_mean_intensity_model(AssertionModel): class base_has_image_mean_intensity_model_relaxed(AssertionModel): """base model for has_image_mean_intensity describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_image_mean_intensity_model_relaxed") + channel: typing.Optional[typing.Union[str, int]] = Field( None, + title="Channel", description=has_image_mean_intensity_channel_description, ) slice: typing.Optional[typing.Union[str, int]] = Field( None, + title="Slice", description=has_image_mean_intensity_slice_description, ) frame: typing.Optional[typing.Union[str, int]] = Field( None, + title="Frame", description=has_image_mean_intensity_frame_description, ) mean_intensity: typing.Optional[typing.Union[float, str]] = Field( None, + title="Mean Intensity", description=has_image_mean_intensity_mean_intensity_description, ) eps: Annotated[typing.Union[float, str], BeforeValidator(check_non_negative_if_set)] = Field( 0.01, + title="Eps", description=has_image_mean_intensity_eps_description, ) min: typing.Optional[typing.Union[float, str]] = Field( None, + title="Min", description=has_image_mean_intensity_min_description, ) max: typing.Optional[typing.Union[float, str]] = Field( None, + title="Max", description=has_image_mean_intensity_max_description, ) @@ -3031,13 +3470,15 @@ class has_image_mean_intensity_model(base_has_image_mean_intensity_model): The mean intensity value is plus/minus ``eps`` (e.g., ````). Alternatively the range of the expected mean intensity value can be specified by ``min`` and/or ``max``.""" - that: Literal["has_image_mean_intensity"] = "has_image_mean_intensity" + model_config = ConfigDict(extra="forbid", title="Assert Has Image Mean Intensity") + that: Literal["has_image_mean_intensity"] = Field("has_image_mean_intensity", title="That") class has_image_mean_intensity_model_nested(AssertionModel): r"""Nested version of this assertion model.""" - has_image_mean_intensity: base_has_image_mean_intensity_model + model_config = ConfigDict(extra="forbid", title="Assert Has Image Mean Intensity (Nested)") + has_image_mean_intensity: base_has_image_mean_intensity_model = Field(..., title="Assert Has Image Mean Intensity") class has_image_mean_intensity_model_relaxed(base_has_image_mean_intensity_model_relaxed): @@ -3046,7 +3487,8 @@ class has_image_mean_intensity_model_relaxed(base_has_image_mean_intensity_model The mean intensity value is plus/minus ``eps`` (e.g., ````). Alternatively the range of the expected mean intensity value can be specified by ``min`` and/or ``max``.""" - that: Literal["has_image_mean_intensity"] = "has_image_mean_intensity" + model_config = ConfigDict(extra="forbid", title="Assert Has Image Mean Intensity (Relaxed)") + that: Literal["has_image_mean_intensity"] = Field("has_image_mean_intensity", title="That") has_image_mean_object_size_channel_description = """Restricts the assertion to a specific channel of the image (where ``0`` corresponds to the first image channel).""" @@ -3077,28 +3519,35 @@ has_image_mean_object_size_max_description = ( class base_has_image_mean_object_size_model(AssertionModel): """base model for has_image_mean_object_size describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_image_mean_object_size_model") + channel: typing.Optional[StrictInt] = Field( None, + title="Channel", description=has_image_mean_object_size_channel_description, ) slice: typing.Optional[StrictInt] = Field( None, + title="Slice", description=has_image_mean_object_size_slice_description, ) frame: typing.Optional[StrictInt] = Field( None, + title="Frame", description=has_image_mean_object_size_frame_description, ) - labels: typing.Optional[typing.List[int]] = Field( + labels: typing.Optional[typing.List[typing.Union[StrictInt, StrictFloat]]] = Field( None, + title="Labels", description=has_image_mean_object_size_labels_description, ) - exclude_labels: typing.Optional[typing.List[int]] = Field( + exclude_labels: typing.Optional[typing.List[typing.Union[StrictInt, StrictFloat]]] = Field( None, + title="Exclude Labels", description=has_image_mean_object_size_exclude_labels_description, ) @@ -3106,11 +3555,13 @@ class base_has_image_mean_object_size_model(AssertionModel): typing.Optional[typing.Union[StrictInt, StrictFloat]], BeforeValidator(check_non_negative_if_set) ] = Field( None, + title="Mean Object Size", description=has_image_mean_object_size_mean_object_size_description, ) eps: Annotated[typing.Union[StrictInt, StrictFloat], BeforeValidator(check_non_negative_if_set)] = Field( 0.01, + title="Eps", description=has_image_mean_object_size_eps_description, ) @@ -3118,6 +3569,7 @@ class base_has_image_mean_object_size_model(AssertionModel): typing.Optional[typing.Union[StrictInt, StrictFloat]], BeforeValidator(check_non_negative_if_set) ] = Field( None, + title="Min", description=has_image_mean_object_size_min_description, ) @@ -3125,6 +3577,7 @@ class base_has_image_mean_object_size_model(AssertionModel): typing.Optional[typing.Union[StrictInt, StrictFloat]], BeforeValidator(check_non_negative_if_set) ] = Field( None, + title="Max", description=has_image_mean_object_size_max_description, ) @@ -3132,28 +3585,35 @@ class base_has_image_mean_object_size_model(AssertionModel): class base_has_image_mean_object_size_model_relaxed(AssertionModel): """base model for has_image_mean_object_size describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_image_mean_object_size_model_relaxed") + channel: typing.Optional[typing.Union[str, int]] = Field( None, + title="Channel", description=has_image_mean_object_size_channel_description, ) slice: typing.Optional[typing.Union[str, int]] = Field( None, + title="Slice", description=has_image_mean_object_size_slice_description, ) frame: typing.Optional[typing.Union[str, int]] = Field( None, + title="Frame", description=has_image_mean_object_size_frame_description, ) - labels: typing.Optional[typing.Union[str, typing.List[int]]] = Field( + labels: typing.Optional[typing.Union[str, typing.List[typing.Union[float, int]]]] = Field( None, + title="Labels", description=has_image_mean_object_size_labels_description, ) - exclude_labels: typing.Optional[typing.Union[str, typing.List[int]]] = Field( + exclude_labels: typing.Optional[typing.Union[str, typing.List[typing.Union[float, int]]]] = Field( None, + title="Exclude Labels", description=has_image_mean_object_size_exclude_labels_description, ) @@ -3161,21 +3621,25 @@ class base_has_image_mean_object_size_model_relaxed(AssertionModel): typing.Optional[typing.Union[float, str]], BeforeValidator(check_non_negative_if_set) ] = Field( None, + title="Mean Object Size", description=has_image_mean_object_size_mean_object_size_description, ) eps: Annotated[typing.Union[float, str], BeforeValidator(check_non_negative_if_set)] = Field( 0.01, + title="Eps", description=has_image_mean_object_size_eps_description, ) min: Annotated[typing.Optional[typing.Union[float, str]], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Min", description=has_image_mean_object_size_min_description, ) max: Annotated[typing.Optional[typing.Union[float, str]], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Max", description=has_image_mean_object_size_max_description, ) @@ -3187,13 +3651,17 @@ class has_image_mean_object_size_model(base_has_image_mean_object_size_model): The labels must be unique.""" - that: Literal["has_image_mean_object_size"] = "has_image_mean_object_size" + model_config = ConfigDict(extra="forbid", title="Assert Has Image Mean Object Size") + that: Literal["has_image_mean_object_size"] = Field("has_image_mean_object_size", title="That") class has_image_mean_object_size_model_nested(AssertionModel): r"""Nested version of this assertion model.""" - has_image_mean_object_size: base_has_image_mean_object_size_model + model_config = ConfigDict(extra="forbid", title="Assert Has Image Mean Object Size (Nested)") + has_image_mean_object_size: base_has_image_mean_object_size_model = Field( + ..., title="Assert Has Image Mean Object Size" + ) class has_image_mean_object_size_model_relaxed(base_has_image_mean_object_size_model_relaxed): @@ -3203,7 +3671,8 @@ class has_image_mean_object_size_model_relaxed(base_has_image_mean_object_size_m The labels must be unique.""" - that: Literal["has_image_mean_object_size"] = "has_image_mean_object_size" + model_config = ConfigDict(extra="forbid", title="Assert Has Image Mean Object Size (Relaxed)") + that: Literal["has_image_mean_object_size"] = Field("has_image_mean_object_size", title="That") has_image_n_labels_channel_description = """Restricts the assertion to a specific channel of the image (where ``0`` corresponds to the first image channel).""" @@ -3232,53 +3701,65 @@ has_image_n_labels_negate_description = """A boolean that can be set to true to class base_has_image_n_labels_model(AssertionModel): """base model for has_image_n_labels describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_image_n_labels_model") + channel: typing.Optional[StrictInt] = Field( None, + title="Channel", description=has_image_n_labels_channel_description, ) slice: typing.Optional[StrictInt] = Field( None, + title="Slice", description=has_image_n_labels_slice_description, ) frame: typing.Optional[StrictInt] = Field( None, + title="Frame", description=has_image_n_labels_frame_description, ) - labels: typing.Optional[typing.List[int]] = Field( + labels: typing.Optional[typing.List[typing.Union[StrictInt, StrictFloat]]] = Field( None, + title="Labels", description=has_image_n_labels_labels_description, ) - exclude_labels: typing.Optional[typing.List[int]] = Field( + exclude_labels: typing.Optional[typing.List[typing.Union[StrictInt, StrictFloat]]] = Field( None, + title="Exclude Labels", description=has_image_n_labels_exclude_labels_description, ) n: Annotated[typing.Optional[StrictInt], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="N", description=has_image_n_labels_n_description, ) delta: Annotated[StrictInt, BeforeValidator(check_non_negative_if_set)] = Field( 0, + title="Delta", description=has_image_n_labels_delta_description, ) min: Annotated[typing.Optional[StrictInt], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Min", description=has_image_n_labels_min_description, ) max: Annotated[typing.Optional[StrictInt], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Max", description=has_image_n_labels_max_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=has_image_n_labels_negate_description, ) @@ -3286,53 +3767,65 @@ class base_has_image_n_labels_model(AssertionModel): class base_has_image_n_labels_model_relaxed(AssertionModel): """base model for has_image_n_labels describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_image_n_labels_model_relaxed") + channel: typing.Optional[typing.Union[str, int]] = Field( None, + title="Channel", description=has_image_n_labels_channel_description, ) slice: typing.Optional[typing.Union[str, int]] = Field( None, + title="Slice", description=has_image_n_labels_slice_description, ) frame: typing.Optional[typing.Union[str, int]] = Field( None, + title="Frame", description=has_image_n_labels_frame_description, ) - labels: typing.Optional[typing.Union[str, typing.List[int]]] = Field( + labels: typing.Optional[typing.Union[str, typing.List[typing.Union[float, int]]]] = Field( None, + title="Labels", description=has_image_n_labels_labels_description, ) - exclude_labels: typing.Optional[typing.Union[str, typing.List[int]]] = Field( + exclude_labels: typing.Optional[typing.Union[str, typing.List[typing.Union[float, int]]]] = Field( None, + title="Exclude Labels", description=has_image_n_labels_exclude_labels_description, ) n: Annotated[typing.Optional[typing.Union[str, int]], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="N", description=has_image_n_labels_n_description, ) delta: Annotated[typing.Union[int, str], BeforeValidator(check_non_negative_if_set)] = Field( 0, + title="Delta", description=has_image_n_labels_delta_description, ) min: Annotated[typing.Optional[typing.Union[str, int]], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Min", description=has_image_n_labels_min_description, ) max: Annotated[typing.Optional[typing.Union[str, int]], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Max", description=has_image_n_labels_max_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=has_image_n_labels_negate_description, ) @@ -3345,13 +3838,15 @@ class has_image_n_labels_model(base_has_image_n_labels_model): The primary usage of this assertion is to verify the number of objects in images with uniquely labeled objects.""" - that: Literal["has_image_n_labels"] = "has_image_n_labels" + model_config = ConfigDict(extra="forbid", title="Assert Has Image N Labels") + that: Literal["has_image_n_labels"] = Field("has_image_n_labels", title="That") class has_image_n_labels_model_nested(AssertionModel): r"""Nested version of this assertion model.""" - has_image_n_labels: base_has_image_n_labels_model + model_config = ConfigDict(extra="forbid", title="Assert Has Image N Labels (Nested)") + has_image_n_labels: base_has_image_n_labels_model = Field(..., title="Assert Has Image N Labels") class has_image_n_labels_model_relaxed(base_has_image_n_labels_model_relaxed): @@ -3362,7 +3857,8 @@ class has_image_n_labels_model_relaxed(base_has_image_n_labels_model_relaxed): The primary usage of this assertion is to verify the number of objects in images with uniquely labeled objects.""" - that: Literal["has_image_n_labels"] = "has_image_n_labels" + model_config = ConfigDict(extra="forbid", title="Assert Has Image N Labels (Relaxed)") + that: Literal["has_image_n_labels"] = Field("has_image_n_labels", title="That") has_image_width_width_description = """Expected width of the image (in pixels).""" @@ -3379,28 +3875,35 @@ has_image_width_negate_description = """A boolean that can be set to true to neg class base_has_image_width_model(AssertionModel): """base model for has_image_width describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_image_width_model") + width: Annotated[typing.Optional[StrictInt], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Width", description=has_image_width_width_description, ) delta: Annotated[StrictInt, BeforeValidator(check_non_negative_if_set)] = Field( 0, + title="Delta", description=has_image_width_delta_description, ) min: Annotated[typing.Optional[StrictInt], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Min", description=has_image_width_min_description, ) max: Annotated[typing.Optional[StrictInt], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Max", description=has_image_width_max_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=has_image_width_negate_description, ) @@ -3408,28 +3911,35 @@ class base_has_image_width_model(AssertionModel): class base_has_image_width_model_relaxed(AssertionModel): """base model for has_image_width describing attributes.""" + model_config = ConfigDict(extra="forbid", title="base_has_image_width_model_relaxed") + width: Annotated[typing.Optional[typing.Union[str, int]], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Width", description=has_image_width_width_description, ) delta: Annotated[typing.Union[int, str], BeforeValidator(check_non_negative_if_set)] = Field( 0, + title="Delta", description=has_image_width_delta_description, ) min: Annotated[typing.Optional[typing.Union[str, int]], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Min", description=has_image_width_min_description, ) max: Annotated[typing.Optional[typing.Union[str, int]], BeforeValidator(check_non_negative_if_set)] = Field( None, + title="Max", description=has_image_width_max_description, ) negate: typing.Union[bool, str] = Field( False, + title="Negate", description=has_image_width_negate_description, ) @@ -3440,13 +3950,15 @@ class has_image_width_model(base_has_image_width_model): The width is plus/minus ``delta`` (e.g., ````). Alternatively the range of the expected width can be specified by ``min`` and/or ``max``.""" - that: Literal["has_image_width"] = "has_image_width" + model_config = ConfigDict(extra="forbid", title="Assert Has Image Width") + that: Literal["has_image_width"] = Field("has_image_width", title="That") class has_image_width_model_nested(AssertionModel): r"""Nested version of this assertion model.""" - has_image_width: base_has_image_width_model + model_config = ConfigDict(extra="forbid", title="Assert Has Image Width (Nested)") + has_image_width: base_has_image_width_model = Field(..., title="Assert Has Image Width") class has_image_width_model_relaxed(base_has_image_width_model_relaxed): @@ -3455,7 +3967,8 @@ class has_image_width_model_relaxed(base_has_image_width_model_relaxed): The width is plus/minus ``delta`` (e.g., ````). Alternatively the range of the expected width can be specified by ``min`` and/or ``max``.""" - that: Literal["has_image_width"] = "has_image_width" + model_config = ConfigDict(extra="forbid", title="Assert Has Image Width (Relaxed)") + that: Literal["has_image_width"] = Field("has_image_width", title="That") any_assertion_model_flat = Annotated[ @@ -3566,76 +4079,97 @@ any_assertion_model_flat_relaxed = Annotated[ Field(discriminator="that"), ] -assertion_list = RootModel[typing.List[typing.Union[any_assertion_model_flat, any_assertion_model_nested]]] + +class assertion_list(RootModel[typing.List[typing.Union[any_assertion_model_flat, any_assertion_model_nested]]]): + model_config = ConfigDict(title="assertion_list") + # used to model what the XML conversion should look like - not meant to be consumed outside of # of Galaxy internals / linting. -relaxed_assertion_list = RootModel[typing.List[any_assertion_model_flat_relaxed]] +class relaxed_assertion_list(RootModel[typing.List[any_assertion_model_flat_relaxed]]): + model_config = ConfigDict(title="relaxed_assertion_list") class assertion_dict(AssertionModel): + model_config = ConfigDict(extra="forbid", title="assertion_dict") - has_line: typing.Optional[base_has_line_model] = None + has_line: typing.Optional[base_has_line_model] = Field(None, title="Assert Has Line") - has_line_matching: typing.Optional[base_has_line_matching_model] = None + has_line_matching: typing.Optional[base_has_line_matching_model] = Field(None, title="Assert Has Line Matching") - has_n_lines: typing.Optional[base_has_n_lines_model] = None + has_n_lines: typing.Optional[base_has_n_lines_model] = Field(None, title="Assert Has N Lines") - has_text: typing.Optional[base_has_text_model] = None + has_text: typing.Optional[base_has_text_model] = Field(None, title="Assert Has Text") - has_text_matching: typing.Optional[base_has_text_matching_model] = None + has_text_matching: typing.Optional[base_has_text_matching_model] = Field(None, title="Assert Has Text Matching") - not_has_text: typing.Optional[base_not_has_text_model] = None + not_has_text: typing.Optional[base_not_has_text_model] = Field(None, title="Assert Not Has Text") - has_n_columns: typing.Optional[base_has_n_columns_model] = None + has_n_columns: typing.Optional[base_has_n_columns_model] = Field(None, title="Assert Has N Columns") - attribute_is: typing.Optional[base_attribute_is_model] = None + attribute_is: typing.Optional[base_attribute_is_model] = Field(None, title="Assert Attribute Is") - attribute_matches: typing.Optional[base_attribute_matches_model] = None + attribute_matches: typing.Optional[base_attribute_matches_model] = Field(None, title="Assert Attribute Matches") - element_text: typing.Optional[base_element_text_model] = None + element_text: typing.Optional[base_element_text_model] = Field(None, title="Assert Element Text") - element_text_is: typing.Optional[base_element_text_is_model] = None + element_text_is: typing.Optional[base_element_text_is_model] = Field(None, title="Assert Element Text Is") - element_text_matches: typing.Optional[base_element_text_matches_model] = None + element_text_matches: typing.Optional[base_element_text_matches_model] = Field( + None, title="Assert Element Text Matches" + ) - has_element_with_path: typing.Optional[base_has_element_with_path_model] = None + has_element_with_path: typing.Optional[base_has_element_with_path_model] = Field( + None, title="Assert Has Element With Path" + ) - has_n_elements_with_path: typing.Optional[base_has_n_elements_with_path_model] = None + has_n_elements_with_path: typing.Optional[base_has_n_elements_with_path_model] = Field( + None, title="Assert Has N Elements With Path" + ) - is_valid_xml: typing.Optional[base_is_valid_xml_model] = None + is_valid_xml: typing.Optional[base_is_valid_xml_model] = Field(None, title="Assert Is Valid Xml") - xml_element: typing.Optional[base_xml_element_model] = None + xml_element: typing.Optional[base_xml_element_model] = Field(None, title="Assert Xml Element") - has_json_property_with_text: typing.Optional[base_has_json_property_with_text_model] = None + has_json_property_with_text: typing.Optional[base_has_json_property_with_text_model] = Field( + None, title="Assert Has Json Property With Text" + ) - has_json_property_with_value: typing.Optional[base_has_json_property_with_value_model] = None + has_json_property_with_value: typing.Optional[base_has_json_property_with_value_model] = Field( + None, title="Assert Has Json Property With Value" + ) - has_h5_attribute: typing.Optional[base_has_h5_attribute_model] = None + has_h5_attribute: typing.Optional[base_has_h5_attribute_model] = Field(None, title="Assert Has H5 Attribute") - has_h5_keys: typing.Optional[base_has_h5_keys_model] = None + has_h5_keys: typing.Optional[base_has_h5_keys_model] = Field(None, title="Assert Has H5 Keys") - has_archive_member: typing.Optional[base_has_archive_member_model] = None + has_archive_member: typing.Optional[base_has_archive_member_model] = Field(None, title="Assert Has Archive Member") - has_size: typing.Optional[base_has_size_model] = None + has_size: typing.Optional[base_has_size_model] = Field(None, title="Assert Has Size") - has_image_center_of_mass: typing.Optional[base_has_image_center_of_mass_model] = None + has_image_center_of_mass: typing.Optional[base_has_image_center_of_mass_model] = Field( + None, title="Assert Has Image Center Of Mass" + ) - has_image_channels: typing.Optional[base_has_image_channels_model] = None + has_image_channels: typing.Optional[base_has_image_channels_model] = Field(None, title="Assert Has Image Channels") - has_image_depth: typing.Optional[base_has_image_depth_model] = None + has_image_depth: typing.Optional[base_has_image_depth_model] = Field(None, title="Assert Has Image Depth") - has_image_frames: typing.Optional[base_has_image_frames_model] = None + has_image_frames: typing.Optional[base_has_image_frames_model] = Field(None, title="Assert Has Image Frames") - has_image_height: typing.Optional[base_has_image_height_model] = None + has_image_height: typing.Optional[base_has_image_height_model] = Field(None, title="Assert Has Image Height") - has_image_mean_intensity: typing.Optional[base_has_image_mean_intensity_model] = None + has_image_mean_intensity: typing.Optional[base_has_image_mean_intensity_model] = Field( + None, title="Assert Has Image Mean Intensity" + ) - has_image_mean_object_size: typing.Optional[base_has_image_mean_object_size_model] = None + has_image_mean_object_size: typing.Optional[base_has_image_mean_object_size_model] = Field( + None, title="Assert Has Image Mean Object Size" + ) - has_image_n_labels: typing.Optional[base_has_image_n_labels_model] = None + has_image_n_labels: typing.Optional[base_has_image_n_labels_model] = Field(None, title="Assert Has Image N Labels") - has_image_width: typing.Optional[base_has_image_width_model] = None + has_image_width: typing.Optional[base_has_image_width_model] = Field(None, title="Assert Has Image Width") assertions = typing.Union[assertion_list, assertion_dict] diff --git a/lib/galaxy/tool_util_models/test_job.py b/lib/galaxy/tool_util_models/test_job.py index d056231cd95..c20a8e4ea25 100644 --- a/lib/galaxy/tool_util_models/test_job.py +++ b/lib/galaxy/tool_util_models/test_job.py @@ -43,60 +43,65 @@ class _StrictJobModel(StrictModel): model_config = ConfigDict( extra="forbid", populate_by_name=True, - field_title_generator=lambda field_name, field_info: field_name.lower(), ) class HashEntry(_StrictJobModel): - hash_function: HashFunctionNames - hash_value: str + model_config = ConfigDict(extra="forbid", populate_by_name=True, title="HashEntry") + hash_function: Annotated[HashFunctionNames, Field(title="Hash Function")] + hash_value: Annotated[str, Field(title="Hash Value")] class BaseFile(_StrictJobModel): """Fields common to every ``class: File`` variant.""" - class_: Literal["File"] = Field(alias="class") - filetype: Optional[str] = None - dbkey: Optional[str] = None - decompress: Optional[bool] = None - to_posix_lines: Optional[bool] = None - space_to_tab: Optional[bool] = None - deferred: Optional[bool] = None - name: Optional[str] = None - info: Optional[str] = None - tags: Optional[list[str]] = None - hashes: Optional[list[HashEntry]] = None - identifier: Optional[str] = None + model_config = ConfigDict(extra="forbid", populate_by_name=True, title="BaseFile") + class_: Literal["File"] = Field(alias="class", title="Class") + filetype: Annotated[Optional[str], Field(title="File Type")] = None + dbkey: Annotated[Optional[str], Field(title="Dbkey")] = None + decompress: Annotated[Optional[bool], Field(title="Decompress")] = None + to_posix_lines: Annotated[Optional[bool], Field(title="To POSIX Lines")] = None + space_to_tab: Annotated[Optional[bool], Field(title="Space To Tab")] = None + deferred: Annotated[Optional[bool], Field(title="Deferred")] = None + name: Annotated[Optional[str], Field(title="Name")] = None + info: Annotated[Optional[str], Field(title="Info")] = None + tags: Annotated[Optional[list[str]], Field(title="Tags")] = None + hashes: Annotated[Optional[list[HashEntry]], Field(title="Hashes")] = None + identifier: Annotated[Optional[str], Field(title="Identifier")] = None class LocationFile(BaseFile): - location: str - path: Optional[str] = None - contents: Optional[str] = None - composite_data: Optional[list[str]] = None + model_config = ConfigDict(extra="forbid", populate_by_name=True, title="LocationFile") + location: Annotated[str, Field(title="Location")] + path: Annotated[Optional[str], Field(title="Path")] = None + contents: Annotated[Optional[str], Field(title="Contents")] = None + composite_data: Annotated[Optional[list[str]], Field(title="Composite Data")] = None class PathFile(BaseFile): - path: str - location: Optional[str] = None - contents: Optional[str] = None - composite_data: Optional[list[str]] = None + model_config = ConfigDict(extra="forbid", populate_by_name=True, title="PathFile") + path: Annotated[str, Field(title="Path")] + location: Annotated[Optional[str], Field(title="Location")] = None + contents: Annotated[Optional[str], Field(title="Contents")] = None + composite_data: Annotated[Optional[list[str]], Field(title="Composite Data")] = None class ContentsFile(BaseFile): """CWL File literal — content inlined as a string.""" - contents: str - path: Optional[str] = None - location: Optional[str] = None - composite_data: Optional[list[str]] = None + model_config = ConfigDict(extra="forbid", populate_by_name=True, title="ContentsFile") + contents: Annotated[str, Field(title="Contents")] + path: Annotated[Optional[str], Field(title="Path")] = None + location: Annotated[Optional[str], Field(title="Location")] = None + composite_data: Annotated[Optional[list[str]], Field(title="Composite Data")] = None class CompositeDataFile(BaseFile): - composite_data: list[str] - path: Optional[str] = None - location: Optional[str] = None - contents: Optional[str] = None + model_config = ConfigDict(extra="forbid", populate_by_name=True, title="CompositeDataFile") + composite_data: Annotated[list[str], Field(title="Composite Data")] + path: Annotated[Optional[str], Field(title="Path")] = None + location: Annotated[Optional[str], Field(title="Location")] = None + contents: Annotated[Optional[str], Field(title="Contents")] = None def _discriminate_file(v): @@ -133,12 +138,13 @@ File = Annotated[ class Collection(_StrictJobModel): - class_: Literal["Collection"] = Field(alias="class") - collection_type: CollectionType = None - name: Optional[str] = None - identifier: Optional[str] = None - elements: Optional[list["CollectionElement"]] = None - rows: Optional[dict[str, list]] = None + model_config = ConfigDict(extra="forbid", populate_by_name=True, title="Collection") + class_: Literal["Collection"] = Field(alias="class", title="Class") + collection_type: Annotated[CollectionType, Field(title="Collection Type")] = None + name: Annotated[Optional[str], Field(title="Name")] = None + identifier: Annotated[Optional[str], Field(title="Identifier")] = None + elements: Annotated[Optional[list["CollectionElement"]], Field(title="Elements")] = None + rows: Annotated[Optional[dict[str, list]], Field(title="Rows")] = None CollectionElement = Annotated[ @@ -155,11 +161,12 @@ class Directory(_StrictJobModel): does not use it. """ - class_: Literal["Directory"] = Field(alias="class") - path: Optional[str] = None - location: Optional[str] = None - filetype: Optional[str] = None - name: Optional[str] = None + model_config = ConfigDict(extra="forbid", populate_by_name=True, title="Directory") + class_: Literal["Directory"] = Field(alias="class", title="Class") + path: Annotated[Optional[str], Field(title="Path")] = None + location: Annotated[Optional[str], Field(title="Location")] = None + filetype: Annotated[Optional[str], Field(title="File Type")] = None + name: Annotated[Optional[str], Field(title="Name")] = None # JobParamValue is non-recursive at the list axis: a job-param list may contain @@ -179,4 +186,6 @@ JobParamValue = Union[ list[Union[File, str, int, float, bool, None]], ] -Job = RootModel[dict[str, JobParamValue]] + +class Job(RootModel[dict[str, JobParamValue]]): + model_config = ConfigDict(title="Job") diff --git a/test/unit/tool_util_models/test_output_assertions.py b/test/unit/tool_util_models/test_output_assertions.py index 2fa8823ac26..c1af212d2c8 100644 --- a/test/unit/tool_util_models/test_output_assertions.py +++ b/test/unit/tool_util_models/test_output_assertions.py @@ -93,3 +93,81 @@ def test_json_schema_emits_discriminator_for_outputs(): schema = Tests.model_json_schema() dumped = json.dumps(schema) assert "discriminator" in dumped or '"oneOf"' in dumped + + +def test_doc_is_optional_on_test_job(): + tests = Tests.model_validate([{"job": {}, "outputs": {}}]) + assert tests.root[0].doc is None + schema = Tests.model_json_schema() + test_job = schema["$defs"]["TestJob"] + assert "doc" not in test_job.get("required", []) + + +def test_test_job_top_level_properties_have_descriptions(): + schema = Tests.model_json_schema() + props = schema["$defs"]["TestJob"]["properties"] + for name in ("doc", "job", "outputs", "expect_failure"): + assert props[name].get("description"), f"missing description on TestJob.{name}" + + +def test_test_job_titles_are_human_readable_not_lowercase(): + schema = Tests.model_json_schema() + props = schema["$defs"]["TestJob"]["properties"] + assert props["doc"]["title"] == "Doc" + assert props["outputs"]["title"] == "Outputs" + assert props["expect_failure"]["title"] == "Expect Failure" + + +def test_assertion_model_titles_are_human_readable(): + schema = Tests.model_json_schema() + defs = schema["$defs"] + assert defs["has_text_model"]["title"] == "Assert Has Text" + assert defs["has_text_model_nested"]["title"] == "Assert Has Text (Nested)" + # Every field in has_text_model has an explicit title. + for name, prop in defs["has_text_model"]["properties"].items(): + assert prop.get("title"), f"has_text_model.{name} missing title" + + +def test_test_data_output_assertions_field_titles(): + schema = Tests.model_json_schema() + props = schema["$defs"]["TestDataOutputAssertions"]["properties"] + assert props["lines_diff"]["title"] == "Lines Diff" + assert props["class"]["title"] == "Class" + assert props["ftype"]["title"] == "File Type" + + +def test_top_level_schema_has_title_description_and_schema(): + schema = Tests.model_json_schema() + assert schema.get("title") == "GalaxyWorkflowTests" + assert schema.get("description") + assert schema.get("$schema") == "https://json-schema.org/draft/2020-12/schema" + + +def test_root_model_wrappers_have_clean_defs_keys(): + schema = Tests.model_json_schema() + defs = schema["$defs"] + assert "Job" in defs + assert "assertion_list" in defs + # None of the RootModel-auto-generated mangled names should appear. + mangled = [k for k in defs if k.startswith("RootModel_")] + assert not mangled, f"unexpected mangled RootModel defs: {mangled}" + + +def test_test_data_output_assertions_properties_have_descriptions(): + schema = Tests.model_json_schema() + props = schema["$defs"]["TestDataOutputAssertions"]["properties"] + for name in ( + "asserts", + "metadata", + "file", + "ftype", + "sort", + "checksum", + "compare", + "lines_diff", + "decompress", + "delta", + "delta_frac", + "location", + ): + assert props[name].get("description"), f"missing description on TestDataOutputAssertions.{name}"