def test_with_no_children_returns_none(self): """If there are no child rows, return None""" data = DataFrame( data={ "Item ARK": ["ark:/work/1"], "Parent ARK": ["ark:/collection/1"], "Thumbnail URL": [None], "Title": [None], }) record = {"ark_ssi": "ark:/work/1"} result = feed_ursus.thumbnail_from_child(record, config={"data_frame": data}) assert result is None
def test_defaults_to_first(self): """Returns the thumbnail from first child row if it can't find 'f. 001r'""" data = DataFrame( data={ "Item ARK": ["ark:/work/1", "ark:/child/2", "ark:/child/1"], "Parent ARK": ["ark:/collection/1", "ark:/work/1", "ark:/work/1"], "Thumbnail URL": [None, "/thumb2.jpg", "/thumb1.jpg"], "Title": [None, "f. 001v", "f. 002r"], } ) record = {"ark_ssi": "ark:/work/1"} result = feed_ursus.thumbnail_from_child(record, config={"data_frame": data}) assert result == "/thumb2.jpg"
def test_uses_mapper(self): """Uses the mapper to generate a thumbnail from access_copy, if necessary""" data = DataFrame( data={ "Item ARK": ["ark:/work/1", "ark:/child/1"], "Parent ARK": ["ark:/collection/1", "ark:/work/1"], "IIIF Access URL": [None, "http://iiif.url/123"], "Title": [None, "f. 001r"], }) record = {"ark_ssi": "ark:/work/1"} result = feed_ursus.thumbnail_from_child(record, config={"data_frame": data}) assert result == "http://iiif.url/123/full/!200,200/0/default.jpg"