Skip to content

Commit 8b453c2

Browse files
committed
pre-commit
1 parent d7b638b commit 8b453c2

2 files changed

Lines changed: 14 additions & 21 deletions

File tree

tests/unit/ingestion/test_segy_file_headers.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,20 @@ def test_invalid_row_count_raises(self) -> None:
7979
bad_text = "\n".join(["X" * 80] * 39)
8080
info = _make_segy_info(text_header=bad_text)
8181
ds = _empty_dataset()
82-
with patch.dict(os.environ, {"MDIO__IMPORT__SAVE_SEGY_FILE_HEADER": "true"}):
83-
with pytest.raises(ValueError, match="Invalid text header count"):
84-
_add_segy_file_headers(ds, info)
82+
with (
83+
patch.dict(os.environ, {"MDIO__IMPORT__SAVE_SEGY_FILE_HEADER": "true"}),
84+
pytest.raises(ValueError, match="Invalid text header count"),
85+
):
86+
_add_segy_file_headers(ds, info)
8587

8688
def test_invalid_column_count_raises(self) -> None:
8789
"""Text header rows shorter than 80 chars must raise."""
8890
bad_rows = ["X" * 80] * 40
8991
bad_rows[5] = "X" * 79
9092
info = _make_segy_info(text_header="\n".join(bad_rows))
9193
ds = _empty_dataset()
92-
with patch.dict(os.environ, {"MDIO__IMPORT__SAVE_SEGY_FILE_HEADER": "true"}):
93-
with pytest.raises(ValueError, match="Invalid text header columns"):
94-
_add_segy_file_headers(ds, info)
94+
with (
95+
patch.dict(os.environ, {"MDIO__IMPORT__SAVE_SEGY_FILE_HEADER": "true"}),
96+
pytest.raises(ValueError, match="Invalid text header columns"),
97+
):
98+
_add_segy_file_headers(ds, info)

tests/unit/ingestion/test_segy_header_analysis.py

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,7 @@ class TestAnalyzeStreamerHeaders:
4444

4545
def test_non_overlapping_channels_returns_type_b(self) -> None:
4646
"""Non-overlapping cable channel ranges should produce Configuration B."""
47-
records: list[tuple[int, int]] = []
48-
for cable in (1, 2, 3):
49-
for chan in range(1, 6):
50-
records.append((cable, (cable - 1) * 5 + chan))
51-
47+
records = [(cable, (cable - 1) * 5 + chan) for cable in (1, 2, 3) for chan in range(1, 6)]
5248
headers = _streamer_headers(records)
5349

5450
unique_cables, mins, maxs, geom = analyze_streamer_headers(headers)
@@ -60,11 +56,7 @@ def test_non_overlapping_channels_returns_type_b(self) -> None:
6056

6157
def test_overlapping_channels_returns_type_a(self) -> None:
6258
"""Overlapping channel ranges between cables should produce Configuration A."""
63-
records: list[tuple[int, int]] = []
64-
for cable in (1, 2):
65-
for chan in range(1, 6):
66-
records.append((cable, chan))
67-
59+
records = [(cable, chan) for cable in (1, 2) for chan in range(1, 6)]
6860
headers = _streamer_headers(records)
6961
unique_cables, _, _, geom = analyze_streamer_headers(headers)
7062

@@ -102,11 +94,8 @@ def test_dense_shots_per_gun_returns_type_a(self) -> None:
10294
def test_interleaved_shots_returns_type_b(self) -> None:
10395
"""Interleaved shot numbering (unique per line, sparse per gun) -> Configuration B."""
10496
# Gun 1: odd shots, gun 2: even shots, all unique within the same line.
105-
records = []
106-
for shot in (1, 3, 5):
107-
records.append((200, shot, 1))
108-
for shot in (2, 4, 6):
109-
records.append((200, shot, 2))
97+
records = [(200, shot, 1) for shot in (1, 3, 5)]
98+
records.extend((200, shot, 2) for shot in (2, 4, 6))
11099
headers = _gun_headers(records)
111100

112101
unique_lines, per_line, geom = analyze_lines_for_guns(headers, line_field="sail_line")

0 commit comments

Comments
 (0)