-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Populate remaining tests for schemas. (#29)
* added tests for remaining components in schema files. * removed unused functions in tests/schema/conftest.py * fixed changes for BinaryFileHeader and TraceTextHeader to StructureDataTypeDescriptor * removed unnecessary roundtrip json to model from tests
- Loading branch information
Showing
5 changed files
with
216 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
"""tests for SegyDescriptor components.""" | ||
from typing import Any | ||
|
||
import pytest | ||
|
||
from segy.standards import SegyStandard | ||
from segy.standards.registry import get_spec | ||
|
||
|
||
@pytest.mark.parametrize( | ||
("rev_number", "custom_segy_file_descriptors"), | ||
[(0.0, 1), (1.0, 1)], | ||
indirect=["custom_segy_file_descriptors"], | ||
) | ||
def test_custom_segy_descriptor( | ||
rev_number: float, custom_segy_file_descriptors: dict[str, Any] | ||
) -> None: | ||
"""Test for creating customized SegyDescriptor.""" | ||
rev_spec = get_spec(SegyStandard(rev_number)) | ||
custom_spec = rev_spec.customize( | ||
text_header_spec=custom_segy_file_descriptors["text_header_descriptor"], | ||
binary_header_fields=custom_segy_file_descriptors[ | ||
"binary_header_descriptor" | ||
].fields, | ||
extended_text_spec=None, | ||
trace_header_fields=custom_segy_file_descriptors[ | ||
"trace_header_descriptor" | ||
].fields, | ||
trace_data_spec=custom_segy_file_descriptors["trace_data_descriptor"], | ||
) | ||
assert ( | ||
custom_spec.text_file_header | ||
== custom_segy_file_descriptors["text_header_descriptor"] | ||
) | ||
assert ( | ||
custom_spec.binary_file_header.fields | ||
== custom_segy_file_descriptors["binary_header_descriptor"].fields | ||
) | ||
assert ( | ||
custom_spec.trace.header_descriptor.fields | ||
== custom_segy_file_descriptors["trace_header_descriptor"].fields | ||
) | ||
assert ( | ||
custom_spec.trace.data_descriptor | ||
== custom_segy_file_descriptors["trace_data_descriptor"] | ||
) |