Skip to content

Commit c1dc18a

Browse files
Jamey O'Neillcursoragent
andcommitted
Fix tests: update fixtures for new schema requirements
- Updated VALID_MINIMAL_POSTER to include required conference fields (conferenceName, conferenceYear) - Renamed posterContent -> content throughout validate.py and tests - All validation tests now pass Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 7507069 commit c1dc18a

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

poster2json/validate.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -203,33 +203,33 @@ def validate_titles(titles: list) -> Tuple[bool, List[str]]:
203203

204204
def validate_poster_content(poster_content: dict) -> Tuple[bool, List[str]]:
205205
"""
206-
Validate the posterContent structure.
206+
Validate the content structure.
207207
208208
Args:
209-
poster_content: The posterContent object
209+
poster_content: The content object
210210
211211
Returns:
212212
Tuple of (is_valid, list_of_issues)
213213
"""
214214
issues = []
215215

216216
if not isinstance(poster_content, dict):
217-
return False, ["posterContent must be an object"]
217+
return False, ["content must be an object"]
218218

219219
sections = poster_content.get("sections", [])
220220
if not isinstance(sections, list):
221-
issues.append("posterContent.sections must be an array")
221+
issues.append("content.sections must be an array")
222222
elif len(sections) == 0:
223-
issues.append("posterContent.sections should have at least one section")
223+
issues.append("content.sections should have at least one section")
224224
else:
225225
for i, section in enumerate(sections):
226226
if not isinstance(section, dict):
227-
issues.append(f"posterContent.sections[{i}] must be an object")
227+
issues.append(f"content.sections[{i}] must be an object")
228228
continue
229229
if "sectionTitle" not in section:
230-
issues.append(f"posterContent.sections[{i}] missing 'sectionTitle'")
230+
issues.append(f"content.sections[{i}] missing 'sectionTitle'")
231231
if "sectionContent" not in section:
232-
issues.append(f"posterContent.sections[{i}] missing 'sectionContent'")
232+
issues.append(f"content.sections[{i}] missing 'sectionContent'")
233233

234234
return len(issues) == 0, issues
235235

@@ -316,12 +316,12 @@ def validate_comprehensive(data: dict) -> Dict[str, Union[bool, List[str]]]:
316316
result["field_issues"].extend(issues)
317317

318318
# Poster content validation
319-
if "posterContent" in data:
320-
valid, issues = validate_poster_content(data["posterContent"])
319+
if "content" in data:
320+
valid, issues = validate_poster_content(data["content"])
321321
if not valid:
322322
result["field_issues"].extend(issues)
323323
else:
324-
result["warnings"].append("posterContent is missing - no sections extracted")
324+
result["warnings"].append("content is missing - no sections extracted")
325325

326326
# Caption validation
327327
if "imageCaptions" in data:

tests/test_validate.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"rightsList": [{"rights": "CC-BY-4.0"}],
2222
"descriptions": [{"descriptionType": "Abstract", "description": "A test abstract."}],
2323
"fundingReferences": [{"funderName": "Test Funder"}],
24-
"conference": {},
24+
"conference": {"conferenceName": "Test Conference", "conferenceYear": 2025},
2525
}
2626

2727

@@ -78,6 +78,6 @@ def test_validate_comprehensive_checks_creators_format():
7878
assert any("Family, Given" in str(i) for i in result["field_issues"])
7979

8080

81-
def test_validate_comprehensive_warns_missing_poster_content():
81+
def test_validate_comprehensive_warns_missing_content():
8282
result = validate_comprehensive(VALID_MINIMAL_POSTER)
83-
assert any("posterContent" in str(w) for w in result["warnings"])
83+
assert any("content" in str(w) for w in result["warnings"])

0 commit comments

Comments
 (0)