Source code for runway.config.components.runway._test_def
"""Runway config test definition."""from__future__importannotationsfromtypingimportTYPE_CHECKING,Any,ClassVarfrom....variablesimportVariablefrom...models.runwayimportRunwayTestDefinitionModel,ValidRunwayTestTypeValuesfrom.baseimportConfigComponentDefinitionifTYPE_CHECKING:fromtyping_extensionsimportSelf
[docs]classRunwayTestDefinition(ConfigComponentDefinition[RunwayTestDefinitionModel]):"""Runway test definition."""args:dict[str,Any]name:strrequired:booltype:ClassVar[ValidRunwayTestTypeValues]_supports_vars:tuple[str,...]=("args","required")
def_register_variable(self,var_name:str,var_value:Any)->None:"""Register a variable. Args: var_name: Name of the config field that can contain a variable lookup. var_value: Literal value supplied in the config to be resolved as a variable if it contains a lookup. """self._vars[var_name]=Variable(name=f"{self.name}.{var_name}",value=var_value,variable_type="runway")
[docs]@classmethoddefparse_obj(cls:type[Self],obj:object)->Self:"""Parse a python object into this class. Args: obj: The object to parse. """returncls(RunwayTestDefinitionModel.model_validate(obj))