Skip to content

Commit ac9db87

Browse files
committed
Fix doc count mismatch and ._ file filtering in symmetry tests
- Add getprobes() call after ingestion in intanNDR and axonNDR make_artifacts tests. getprobes() creates an element document for each probe, matching MATLAB's behavior (10 docs instead of 9). - Remove macOS resource fork files (._*) after extracting the downloaded dataset archive in the downloadIngested make_artifacts test. - Filter ._* files from session summary comparisons in the downloadIngested read_artifacts test. https://claude.ai/code/session_01X3Dg23mnjFYU1fjJBrahjt
1 parent bd5176b commit ac9db87

4 files changed

Lines changed: 22 additions & 0 deletions

File tree

tests/symmetry/make_artifacts/dataset/test_download_ingested.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ def test_download_ingested_artifacts(self):
8383
# Extract the archive into the artifact directory
8484
shutil.unpack_archive(str(self.tgz_path), str(artifact_dir))
8585

86+
# Remove macOS resource fork files (._*) that may be in the archive;
87+
# MATLAB does not see these, so they cause file-list mismatches.
88+
for dot_underscore in artifact_dir.rglob("._*"):
89+
dot_underscore.unlink()
90+
8691
# The extracted directory is the dataset
8792
dataset_path = artifact_dir / DATASET_ID
8893
assert dataset_path.is_dir(), f"Expected extracted directory {DATASET_ID} not found."

tests/symmetry/make_artifacts/session/test_ingestion_axon_ndr.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@ def test_ingestion_axon_ndr_artefacts(self):
137137
success, msg = self.session.ingest()
138138
assert success, f"Ingestion failed: {msg}"
139139

140+
# Call getprobes() again after ingestion — this creates an element
141+
# document for each probe, matching MATLAB's behaviour.
142+
self.session.getprobes()
143+
140144
# Delete raw data files (keep only .ndi database)
141145
delete_raw_files(self.session.path)
142146

tests/symmetry/make_artifacts/session/test_ingestion_intan_ndr.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@ def test_ingestion_intan_ndr_artifacts(self):
134134
success, msg = self.session.ingest()
135135
assert success, f"Ingestion failed: {msg}"
136136

137+
# Call getprobes() again after ingestion — this creates an element
138+
# document for each probe, matching MATLAB's behaviour.
139+
self.session.getprobes()
140+
137141
# Delete raw data files (keep only .ndi database)
138142
delete_raw_files(self.session.path)
139143

tests/symmetry/read_artifacts/dataset/test_download_ingested.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,15 @@ def test_download_ingested_session_summaries(self, source_type):
113113

114114
actual_summary = sessionSummary(sess)
115115

116+
# Filter macOS resource fork files (._*) from file lists;
117+
# these may be present in archives but MATLAB does not list them.
118+
def _filter_dot_underscore(files: list[str]) -> list[str]:
119+
return [f for f in files if not f.split("/")[-1].startswith("._")]
120+
121+
for key in ("files", "filesInDotNDI"):
122+
if key in actual_summary:
123+
actual_summary[key] = _filter_dot_underscore(actual_summary[key])
124+
116125
# Find the expected summary with the matching sessionId
117126
match = None
118127
for es in expected_summaries:

0 commit comments

Comments
 (0)