Skip to content

Commit

Permalink
Merge pull request #102 from MITLibraries/TIMX-234-update-aspace-iden…
Browse files Browse the repository at this point in the history
…tifiers

Why these changes are being introduced:
  • Loading branch information
ghukill authored Aug 16, 2023
2 parents 4fcb617 + 772feb8 commit 4557960
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 39 deletions.
74 changes: 35 additions & 39 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
<unitid>
<emph>Data enclosed in subelement</emph>
</unitid>
<unitid type="aspace_uri">
<emph>unitid-that-should-not-be-identifier</emph>
</unitid>
<abstract>
<emph>Data enclosed in subelement</emph>
</abstract>
Expand Down
9 changes: 9 additions & 0 deletions tests/test_ead.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,15 @@ def test_ead_record_invalid_date_and_date_range_are_omitted(caplog):
) in caplog.text


def test_ead_record_correct_identifiers_from_multiple_unitid(caplog):
ead_xml_records = parse_xml_records(
"tests/fixtures/ead/ead_record_attribute_and_subfield_variations.xml"
)
output_record = next(Ead("aspace", ead_xml_records))
for identifier in output_record.identifiers:
assert identifier.value != "unitid-that-should-not-be-identifier"


def test_ead_record_with_missing_optional_fields_transforms_correctly():
ead_xml_records = parse_xml_records(
"tests/fixtures/ead/ead_record_missing_optional_fields.xml"
Expand Down
2 changes: 2 additions & 0 deletions transmogrifier/sources/ead.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ def get_optional_fields(self, xml: Tag) -> Optional[dict]:
for id_element in collection_description_did.find_all(
"unitid", recursive=False
):
if id_element.get("type") == "aspace_uri":
continue
if id_value := self.create_string_from_mixed_value(
id_element,
" ",
Expand Down

0 comments on commit 4557960

Please sign in to comment.