diff --git a/tests/fixtures/oai_dc/oaidc_record_valid_generic_date.xml b/tests/fixtures/oai_dc/oaidc_record_valid_generic_date.xml deleted file mode 100644 index a378095..0000000 --- a/tests/fixtures/oai_dc/oaidc_record_valid_generic_date.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - -
- oai:libguides.com:guides/175846 - 2023-05-31T19:49:21Z - guides -
- - - Materials Science & Engineering - Ye Li - Engineering - Science - Useful databases and other research tips for materials science. - MIT Libraries - 2008-06-19T17:55:27 - https://libguides.mit.edu/materials - - -
-
\ No newline at end of file diff --git a/tests/sources/xml/test_oai_dc.py b/tests/sources/xml/test_oai_dc.py index 1b16a01..6822fd2 100644 --- a/tests/sources/xml/test_oai_dc.py +++ b/tests/sources/xml/test_oai_dc.py @@ -5,8 +5,6 @@ import transmogrifier.models as timdex from transmogrifier.sources.xml.oaidc import OaiDc -FIXTURES_PREFIX = "tests/fixtures/oai_dc" - def create_oai_dc_source_record_stub(xml_insert: str = "") -> BeautifulSoup: xml_str = f""" @@ -181,6 +179,15 @@ def test_get_dates_transforms_correctly_if_fields_missing( ) +def test_get_dates_transforms_correctly_if_date_invalid(): + source_record = create_oai_dc_source_record_stub( + """ + INVALID + """ + ) + assert OaiDc.get_dates(source_record_id="abc", source_record=source_record) == [] + + def test_get_identifiers_success(oai_dc_record_all_fields): assert OaiDc.get_identifiers(oai_dc_record_all_fields) == [ timdex.Identifier(value="oai:libguides.com:guides/175846", kind="OAI-PMH") @@ -271,17 +278,6 @@ def test_get_summary_transforms_properly_if_fields_missing( assert OaiDc.get_summary(oai_dc_record_optional_fields_missing) == [] -def test_oaidc_generic_date(): - source_records = OaiDc.parse_source_file( - f"{FIXTURES_PREFIX}/oaidc_record_valid_generic_date.xml" - ) - transformer_instance = OaiDc("libguides", source_records) - xml = next(transformer_instance.source_records) - assert transformer_instance.get_dates("test_source_record_id", xml) == [ - timdex.Date(kind="Unknown", note=None, range=None, value="2008-06-19T17:55:27") - ] - - def test_get_main_titles_success(): source_record = create_oai_dc_source_record_stub( """