Test label objects
Tests of the Label data structure in isolation (does not include any tests of files described by labels).
check_ColumnObject
check_ColumnObject(inp: dict[str, Any], obj: ColumnObject, *, allow_errors: bool = False) -> None
Test subroutine: Check that a ColumnObject agrees with the input dictionary it was constructed from.
check_Contacts
check_Contacts(inp: dict[str, Any], obj: Contacts) -> None
Test subroutine: Check that a Contacts object agrees with the input dictionary it was constructed from.
check_DataObject
check_DataObject(inp: dict[str, Any], obj: DataObject) -> None
Test subroutine: Check that a DataObject agrees with the input dictionary it was constructed from.
check_DeliveryMeta
check_DeliveryMeta(inp: dict[str, Any], obj: DeliveryMeta) -> None
Test subroutine: Check that a DeliveryMeta object agrees with the input dictionary it was constructed from.
check_FilePattern
check_FilePattern(inp: dict[str, Any], obj: FilePattern) -> None
Test subroutine: Check that a FilePattern object agrees with the input dictionary it was constructed from.
check_Filetype
check_Filetype(inp: dict[str, Any], obj: Filetype) -> None
Test subroutine: Check that a Filetype object agrees with the input dictionary it was constructed from.
check_FiletypeValidationOptions
check_FiletypeValidationOptions(inp: dict[str, Any], obj: FiletypeValidationOptions) -> None
Test subroutine: Check that a FiletypeValidationOptions object agrees with the input dictionary it was constructed from.
check_GlobalValidationOptions
check_GlobalValidationOptions(inp: dict[str, Any], obj: GlobalValidationOptions) -> None
Test subroutine: Check that a GlobalValidationOptions object agrees with the input dictionary it was constructed from.
check_Label
check_Label(inp: dict[str, Any], obj: Label) -> None
Test subroutine: Check that a Label object agrees with the input dictionary it was constructed from.
check_ObjectMetadata
check_ObjectMetadata(inp: dict[str, Any], obj: ObjectMetadata, *, extra_errors: Sequence[tuple[str, str]] = []) -> None
Test subroutine: Check that an ObjectMetadata object agrees with the input dictionary it was constructed from.
check_TimeInfo
check_TimeInfo(inp: dict[str, date], obj: TimeInfo) -> None
Test subroutine: Check that a TimeInfo object agrees with the input dictionary it was constructed from.
st_good_ColumnObject
st_good_ColumnObject(ty: type[ColumnObject]) -> st.SearchStrategy[dict[str, Any]]
Parametric strategy producing a valid input dictionary for a specific concrete subclass of ColumnObject.
st_good_DataObject
st_good_DataObject(draw: DrawFn, ty: type[DataObject], ix: int | None = None) -> dict[str, Any]
Parametric strategy producing a valid input dictionary for a specific concrete subclass of DataObject. If 'ix' is given, this DataObject will be the object at that index within a Filetype.
st_good_DeliveryMeta
st_good_DeliveryMeta() -> st.SearchStrategy[dict[str, Any]]
Strategy producing a valid ObjectMetadata input dictionary.
st_good_FilePattern
st_good_FilePattern(draw: DrawFn, std: str, *, include: bool | None = None) -> dict[str, Any]
Strategy producing a valid FilePattern input dictionary.
st_good_FiletypeValidationOptions
st_good_FiletypeValidationOptions() -> st.SearchStrategy[dict[str, Any]]
Strategy producing a valid ObjectMetadata input dictionary.
st_good_GlobalValidationOptions
st_good_GlobalValidationOptions() -> st.SearchStrategy[dict[str, Any]]
Strategy producing a valid GlobalValidationOptions input dictionary.
st_good_Label
st_good_Label() -> st.SearchStrategy[dict[str, Any]]
Strategy producing a valid input dictionary for a complete Label.
st_good_ObjectMetadata
st_good_ObjectMetadata(ty: type[ObjectMetadata]) -> st.SearchStrategy[dict[str, Any]]
Parametric strategy producing a valid input dictionary for a specific concrete subclass of ObjectMetadata. Note that, from one point of view, there are no valid input dictionaries for ASDFObjectMetadata; this wrinkle is ignored here and dealt with in check_ObjectMetadata.
st_good_TimeInfo
st_good_TimeInfo() -> st.SearchStrategy[dict[str, date]]
Strategy producing a valid TimeInfo input dictionary.
st_identifier
st_identifier(draw: DrawFn, *, uppercase: bool = True, lowercase: bool = True, digits: bool = True, underscore: bool = True) -> str
Generate a random string that is a valid Python identifier. Only ASCII characters are used. Also handy for "random filename with no extension". Will never produce "true", "false", "none", "null", or "undefined", case insensitively.
Passing False for 'uppercase', 'lowercase', 'digits', and/or 'underscore' will exclude that type of character from the generated identifiers.
st_improper_input_dict
st_improper_input_dict(ltype: type[LabelElement]) -> st.SearchStrategy[dict[str, str]]
Parametric strategy: Given a LabelObject subclass, produce an input dictionary that doesn't contain any of that label's permitted keys, but does contain one or more random keys that aren't permitted.
test_ObjectMetadata_null_value
test_ObjectMetadata_null_value() -> None
Test of the distinction between ObjectMetadata.value being absent and its being explicitly specified as "null".
test_bad_ObjectMetadata_index
test_bad_ObjectMetadata_index(ty: type[ObjectMetadata]) -> None
Test for rejection of an "index" property in ObjectMetadata other than FITSObjectMetadata.
test_bad_dtype_ColumnObject
test_bad_dtype_ColumnObject(ty: type[ColumnObject], data: DataObject) -> None
For each concrete ColumnObject subclass, generate input dictionaries with invalid dtype strings and check that constructed objects log an error.
test_empty
test_empty(ltype: type[LabelElement]) -> None
Test that each concrete LabelObject subclass is constructible from an empty input dictionary. (The result might have errors logged.)
test_good_ColumnObject
test_good_ColumnObject(ty: type[ColumnObject], data: DataObject) -> None
For each concrete ColumnObject subclass, generate random valid input dictionaries and verify that constructed objects match what was passed in.
test_good_Contacts
test_good_Contacts(inp: dict[str, list[str]]) -> None
Generate random valid Contacts input dictionaries and verify that the constructed Contacts object matches what was passed in.
test_good_DataObject
test_good_DataObject(ty: type[DataObject], data: DataObject) -> None
For each concrete DataObject subclass, generate random valid input dictionaries and verify that constructed objects match what was passed in.
test_good_DeliveryMeta
test_good_DeliveryMeta(inp: dict[str, Any]) -> None
Generate random valid DeliveryMeta input dictionaries and verify that the constructed DeliveryMeta object matches what was passed in.
test_good_FilePattern
test_good_FilePattern(ftype: str, data: DataObject) -> None
x For each file format standard where we support data validation, plus two common ones where we don't, generate random valid FilePattern input dictionaries and verify that the constructed FilePattern object matches what was passed in.
test_good_Filetype
test_good_Filetype(ftype: str, data: DataObject) -> None
For each file format standard where we support data validation, plus two common ones where we don't, generate random valid input dictionaries and verify that constructed objects match what was passed in.
test_good_FiletypeValidationOptions
test_good_FiletypeValidationOptions(inp: dict[str, Any]) -> None
Generate random valid FiletypeValidationOptions input dictionaries and verify that the constructed FiletypeValidationOptions object matches what was passed in.
test_good_GlobalValidationOptions
test_good_GlobalValidationOptions(inp: dict[str, Any]) -> None
Generate random valid GlobalValidationOptions input dictionaries and verify that the constructed GlobalValidationOptions object matches what was passed in.
test_good_Label
test_good_Label(inp: dict[str, Any]) -> None
Generate random valid Label input dictionaries and verify that the constructed Label object matches what was passed in.
test_good_ObjectMetadata
test_good_ObjectMetadata(ty: type[ObjectMetadata], data: DataObject) -> None
For each concrete ObjectMetadata subclass, generate random valid input dictionaries and verify that constructed objects match what was passed in.
test_good_TimeInfo
test_good_TimeInfo(inp: dict[str, date]) -> None
Generate random valid TimeInfo input dictionaries and verify that the constructed TimeInfo object matches what was passed in.
test_improper_keys
test_improper_keys(ltype: type[LabelElement], data: DataObject) -> None
Test that, when a concrete LabelObject is constructed from an input dictionary that contains none of the permitted keys, we get back an object with an errors list mentioning all of the keys that were provided.