Skip to content

Commit 8c1999d

Browse files
authored
fix: remove redundant file missing warning (#1496)
1 parent 987c78e commit 8c1999d

File tree

2 files changed

+0
-20
lines changed

2 files changed

+0
-20
lines changed

src/aind_data_schema/core/metadata.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,17 +136,11 @@ def validate_core_fields(cls, value, info: ValidationInfo):
136136
def validate_expected_files_by_modality(self):
137137
"""Validator warns users if required files are missing"""
138138

139-
validated = False
140139
for file in REQUIRED_FILE_SETS.keys():
141140
if getattr(self, file):
142141
for file in REQUIRED_FILE_SETS[file]:
143142
if not getattr(self, file):
144143
warnings.warn(f"Metadata missing required file: {file}")
145-
validated = True
146-
if not validated:
147-
warnings.warn(
148-
f"Metadata must contain at least one of the following files: {list(REQUIRED_FILE_SETS.keys())}"
149-
)
150144

151145
return self
152146

tests/test_metadata.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -315,20 +315,6 @@ def test_validate_expected_files_by_modality(self):
315315
self.assertIn("Metadata missing required file: instrument", warning_messages)
316316
self.assertIn("Metadata missing required file: acquisition", warning_messages)
317317

318-
# Test case where no required files exist
319-
with self.assertWarns(UserWarning) as w:
320-
Metadata(
321-
name="655019_2023-04-03T181709",
322-
location="bucket",
323-
# No required files provided
324-
)
325-
326-
warning_messages = [str(warning.message) for warning in w.warnings]
327-
self.assertIn(
328-
"Metadata must contain at least one of the following files: ['subject', 'processing', 'model']",
329-
warning_messages,
330-
)
331-
332318
def test_validate_acquisition_connections(self):
333319
"""Tests that acquisition connections are validated correctly."""
334320
# Case where all connection devices are present in instrument components

0 commit comments

Comments
 (0)