Skip to content

Commit

Permalink
Update separators for physical_description field
Browse files Browse the repository at this point in the history
* Update separators for physical_description field to improve formatting
* Update fixture and unit test for more thorough testing
  • Loading branch information
ehanson8 committed Oct 5, 2022
1 parent 626373d commit 66f084e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions tests/fixtures/ead/ead_record_all_fields.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@
<extent>4.5 Cubic Feet</extent>
<extent>(10 manuscript boxes, 1 legal manuscript box, 1 cassette box)</extent>
</physdesc>
<physdesc>
<extent>1.5 Cubic Feet</extent>
<extent>(2 manuscript boxes)</extent>
</physdesc>
</did>
<altformavail>
<head>Location of Copies</head>
Expand Down
4 changes: 2 additions & 2 deletions tests/test_ead.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ def test_ead_record_all_fields_transform_correctly():
),
],
physical_description=(
"4.5 Cubic Feet. (10 manuscript boxes, 1 legal manuscript "
"box, 1 cassette box)"
"4.5 Cubic Feet (10 manuscript boxes, 1 legal manuscript "
"box, 1 cassette box); 1.5 Cubic Feet (2 manuscript boxes)"
),
publication_information=[
"Massachusetts Institute of Technology. Libraries. Department of Distinctive "
Expand Down
4 changes: 2 additions & 2 deletions transmogrifier/sources/ead.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,11 @@ def get_optional_fields(self, xml: Tag) -> Optional[dict]:
"physdesc", recursive=False
):
if physical_description_value := self.create_string_from_mixed_value(
physical_description_element, ". "
physical_description_element, " "
):
physical_descriptions.append(physical_description_value)
if physical_descriptions:
fields["physical_description"] = ". ".join(physical_descriptions)
fields["physical_description"] = "; ".join(physical_descriptions)

# publication_frequency field not used in EAD

Expand Down

0 comments on commit 66f084e

Please sign in to comment.