def test_from_marc(): record = marc2record({ '695__': [{ '9': 'eng', 'a': 'keyword1 ; keyword2' }] }) assert record == { 'keyword': [{ 'language': 'en', 'value': ['keyword1', 'keyword2'] }] } record = marc2record({ '695__': [{ '9': 'eng', 'a': 'keyword1 ; keyword2 ; ' }] }) assert record == { 'keyword': [{ 'language': 'en', 'value': ['keyword1', 'keyword2'] }] }
def test_from_marc(): record = marc2record({ '506__': { 'a': u'Accès réservé aux institutions membres de RERO', 'f': 'Restricted access', } }) assert record.get('access_restriction') == 'Restricted access' record = marc2record({ '506__': { 'a': u'Accès réservé aux institutions membres de RERO' } }) assert record.get('access_restriction') == 'Restricted access'
def test_simple_from_marc(): record = marc2record({ '260__': {'c': '2015'} }) assert record.get("publication_date") == {'to': 2015, 'full': '2015', 'from': 2015}
def test_complete_noisy_from_marc(): record = marc2record({ '260__': {'c': '2015 bla 2013 bla 2001'} }) assert record.get("publication_date") == {'to': 2015, 'full': '2001-2015', 'from': 2001}
def test_from_marc(): record = marc2record({ '300__': { 'a': '100 p.', 'b': 'ill.', 'c': '25 x 30 cm' }, '8564_': [{ 'f': 'file_name.pdf', 'q': 'application/pdf', 's': '1014', 'u': 'http://doc.rero.ch/record/file_name.pdf', 'y': 'order:1', 'z': 'Main file' }] }) assert record == { 'document': [{ 'name': 'file_name.pdf', 'mime': 'application/pdf', 'size': 1014, 'url': 'http://doc.rero.ch/record/file_name.pdf', 'label': 'Main file', 'physical_description': { 'extent': '100 p.', 'details': 'ill.', 'dimensions': '25 x 30 cm' } }] }
def test_from_marc(): record = marc2record({ '020__': { 'a': '9782882250209' } }) assert record.get('isbn13') == '9782882250209'
def test_from_marc(self): record = marc2record({ '020__': { 'a': '9782882250209' } }) assert record.get('isbn13') == '9782882250209'
def test_simple_from_marc(self): record = marc2record({ '300__': { 'a': '100' } }) assert record.get('n_pages') == 100
def test_simple_from_marc(self): record = marc2record({ '980__': { 'a': 'BOOK' } }) assert record.get('media_type') == 'http://rdvocab.info/termList/RDAMediaType/1003'
def test_from_marc(self): record = marc2record({ '020__': { 'a': '2-88147-009-2' } }) assert record.get('isbn10') == '2-88147-009-2'
def test_from_marc(): record = marc2record({'490__': {'a': 'Name', 'v': '3'}}) assert record.get('series') == { 'name': 'Name', 'volume': '3', 'full': 'Name ; 3' }
def test_from_marc(): record = marc2record({'250__': {'a': 'Name', 'b': 'Remainder'}}) assert record == { 'edition': { 'statement': 'Name', 'remainder': 'Remainder' } }
def test_from_marc(self): record = marc2record({ '980__': {'a': 'BOOK', 'f': 'BOOK_PROCEED'} }) assert record.get('document_type') == { 'main': 'book', 'sub': 'book_proceed' }
def test_from_marc(): record = marc2record({'695__': [{'9': 'eng', 'a': 'keyword1 ; keyword2'}]}) assert record == { 'keyword': [{ 'lang': 'en', 'content': ['keyword1', 'keyword2'] }] }
def test_from_marc(self): record = marc2record({"300__": {"a": "100 p.", "b": "ill.", "c": "25 x 30 cm"}}) assert record.get("collation") == { "pages": "100 p.", "other": "ill.", "dimension": "25 x 30 cm", "full": "100 p. ill. 25 x 30 cm", }
def test_from_marc(): record = marc2record( {'980__': { 'a': 'BOOK', 'b': 'MEDVS', 'f': 'BOOK_PROCEED' }}) assert record.get('type') == {'main': 'book', 'sub': 'book_proceed'}
def test_from_marc(): record = marc2record({ '260__': { 'a': '[Freiburg] :', 'b': 'Zentral-Komitee S.A.C.,', 'c': '1911 (Bern :' } }) assert record.get('publication') == { 'location': '[Freiburg] :', 'publisher': 'Zentral-Komitee S.A.C.,', 'date_label': '1911 (Bern :', 'start_date': '1911' } record = marc2record({ '260__': { 'a': 'Lyon', 'b': 'Bruyset', 'c': 'an VIII 1800' } }) assert record.get('publication') == { 'location': 'Lyon', 'publisher': 'Bruyset', 'date_label': 'an VIII 1800', 'start_date': '1800' } record = marc2record({ '260__': { 'a': 'Location', 'b': 'Publisher', 'c': '2015-2017', 'e': 'Print Location', 'f': 'Printer' } }) assert record.get('publication') == { 'location': 'Location', 'publisher': 'Publisher', 'date_label': '2015-2017', 'start_date': '2015', 'end_date': '2017' }
def test_from_marc(): record = marc2record({'246__': {'a': 'Other Title', '9': 'eng'}}) assert record == { 'other_title': { 'maintitle': 'Other Title', 'lang': 'en', 'full': 'Other Title' } }
def test_from_marc(): record = marc2record({'250__': {'a': 'Name', 'b': 'Remainder'}}) assert record == { 'edition': { 'name': 'Name', 'remainder': 'Remainder', 'full': 'Name Remainder' } }
def test_from_marc(self): record = marc2record({ '710__': { 'a': 'Corporate name' } }) assert record == { 'corporate': ['Corporate name'] }
def test_from_marc(self): record = marc2record({ '300__': { 'c': '150 x 200 cm' } }) assert record.get('dimension') == { 'width': 150, 'height': 200 }
def test_from_marc(): record = marc2record({'080__': {'a': '004'}}) assert record.get('udc') == { 'code': '004', 'en': 'Computer science', 'fr': 'Informatique', 'de': 'Informatik', 'it': "Informatique", 'uri': ['http://udcdata.info/013566'] }
def test_from_marc(): record = marc2record({ '982__': [{ 'a': 'CODE', 'b': 'Collection Name', }] }) assert record.get('specific_collection') == [{ 'code': 'CODE', 'name': 'Collection Name' }]
def test_complete_from_marc(): record = marc2record({ '260__': { 'c': '2015-2016' } }) assert record.get('publication_date') == { 'from': 2015, 'to': 2016, 'full': '2015-2016' }
def test_from_marc(self): record = marc2record({ '506__': { 'a': u'Accès réservé aux institutions membres de RERO', 'f': 'Restricted access', } }) assert record.get('access_restriction') == { 'message': u'Accès réservé aux institutions membres de RERO', 'code': 'Restricted access' }
def test_complete_from_marc(self): record = marc2record({ '260__': { 'c': '2015-2016' } }) assert record.get('publication_date') == { 'from': 2015, 'to': 2016, 'full': '2015-2016' }
def test_from_marc(self): record = marc2record({ '080__': {'a': '004'} }) assert record.get('udc') == { 'code': '004', 'en': 'Computer science', 'fr': 'Informatique', 'de': 'Informatik', 'it': "Informatique", 'uri': ['http://udcdata.info/013566'] }
def test_from_marc(): record = marc2record( {'520__': [{ 'a': 'Summary Line 1\n Line2', '9': 'eng' }]}) assert record == { 'summary': [{ 'language': 'en', 'value': 'Summary Line 1\n Line2' }] }
def test_from_marc(self): record = marc2record({ '490__': { 'a': 'Name', 'v': '3' } }) assert record.get('series') == { 'name': 'Name', 'volume': '3', 'full': 'Name ; 3' }
def test_from_marc(): record = marc2record({'246__': {'a': 'Other Title', '9': 'eng'}}) assert record == { 'other_title': [{ 'main': 'Other Title', 'language': 'en' }] } record = marc2record( {'246__': { 'a': 'Other Title', 'b': 'Subtitle', '9': 'eng' }}) assert record == { 'other_title': [{ 'main': 'Other Title', 'sub': 'Subtitle', 'language': 'en' }] }
def test_from_marc(self): record = marc2record({ '695__': [{ '9': 'eng', 'a': 'keyword1 ; keyword2' }] }) assert record == { 'keyword': [{ 'lang': 'en', 'content': ['keyword1', 'keyword2'] }] }
def test_from_marc(self): record = marc2record({ '520__': [{ 'a': 'Summary Line 1\n Line2', '9': 'eng' }] }) assert record == { 'summary': [{ 'lang': 'en', 'content': 'Summary Line 1\n Line2' }] }
def test_from_marc(self): record = marc2record({ '775__': { 'g': 'Published Version', 'o': 'http://dx.doi.org/10.1111/j.1365-3032.2012.00840.x' } }) assert record == { 'other_edition': { 'type': 'Published Version', 'url': 'http://dx.doi.org/10.1111/j.1365-3032.2012.00840.x' } }
def test_from_marc(): record = marc2record({ '775__': { 'g': 'Published Version', 'o': 'http://dx.doi.org/10.1111/j.1365-3032.2012.00840.x' } }) assert record == { 'other_edition': { 'type': 'Published Version', 'url': 'http://dx.doi.org/10.1111/j.1365-3032.2012.00840.x' } }
def test_from_marc(): record = marc2record( {'300__': { 'a': '100 p.', 'b': 'ill.', 'c': '25 x 30 cm' }}) assert record.get('collation') == { 'pages': '100 p.', 'other': 'ill.', 'dimension': '25 x 30 cm', 'full': '100 p. ill. 25 x 30 cm' }
def test_from_marc(): record = marc2record( {'245__': { 'a': 'Main Title', 'b': "Subtitle", '9': 'eng' }}) assert record == { 'title': [{ 'main': 'Main Title', 'sub': 'Subtitle', 'language': 'en' }] }
def test_from_marc_utf8(): record = marc2record( {'245__': [{ 'a': 'Neuchâtel mon amour', 'b': "Subtitle", '9': 'eng' }]}) assert record == { 'title': [{ 'main': 'Neuchâtel mon amour', 'sub': 'Subtitle', 'language': 'en' }] }
def test_from_marc(): record = marc2record({ '260__': { 'a': 'Location', 'b': 'Publisher', 'c': '2015-2017', 'e': 'Print Location', 'f': 'Printer' } }) assert record.get('print') == { 'location': 'Print Location', 'printer': 'Printer' }
def test_from_marc(): record = marc2record({ '8564_': [{ 'u': 'http://doc.rero.ch', 'y': '2007-11-25 23:47:43', 'z': 'Home Page' }] }) assert record == { 'external_link': [{ 'url': 'http://doc.rero.ch', 'label': 'Home Page' }] }
def test_lcsh_from_marc(self): record = marc2record({ '600__': [{ '9': '650__', 'a': 'Inventaires' }] }) assert record == { 'subject': [{ 'vocabulary': 'lcsh', 'tag': '650__', 'content': 'Inventaires' }] }
def test_lcsh_from_marc(): record = marc2record({ '600__': [{ '9': '650__', 'a': 'Inventaires' }] }) assert record == { 'subject': [{ 'vocabulary': 'lcsh', 'tag': '650__', 'content': 'Inventaires' }] }
def test_from_marc(): record = marc2record({ '533__': { 'a': 'Type', 'b': 'Location', 'c': 'Agency', 'd': '2015.' } }) assert record.get('digitization') == { 'location': 'Location', 'digitizer': 'Agency', 'date': '2015.' }
def test_from_marc(self): record = marc2record({ '250__': { 'a': 'Name', 'b': 'Remainder' } }) assert record == { 'edition': { 'name': 'Name', 'remainder': 'Remainder', 'full': 'Name Remainder' } }
def test_from_marc(self): record = marc2record({ '8564_': [{ 'u': 'http://doc.rero.ch', 'y': '2007-11-25 23:47:43', 'z': 'Home Page' }] }) assert record == { 'external_link': [{ 'url': 'http://doc.rero.ch', 'datetime': '2007-11-25 23:47:43', 'label': 'Home Page' }] }
def test_from_marc_utf8(): record = marc2record( {'245__': { 'a': 'Neuchâtel mon amour', 'b': "Subtitle", '9': 'eng' }}) assert record == { 'title': { 'maintitle': 'Neuchâtel mon amour', 'subtitle': 'Subtitle', 'lang': 'en', 'full': 'Neuchâtel mon amour Subtitle' } }
def test_from_marc(self): record = marc2record({ '533__': { 'a': 'Type', 'b': 'Location', 'c': 'Agency', 'd': '2015.' } }) assert record.get('reproduction') == { 'type': 'Type', 'location': 'Location', 'agency': 'Agency', 'date': '2015.' }
def test_from_marc(): record = marc2record( {'711__': { 'a': 'Name', 'c': 'Location', 'd': '2015', 'n': '34' }}) assert record.get('meeting') == { 'name': 'Name', 'location': 'Location', 'date': '2015', 'number': '34', 'full': 'Name 34 2015 Location' }
def test_from_marc_utf8(self): record = marc2record({ '245__': { 'a': 'Neuchâtel mon amour', 'b': "Subtitle", '9': 'eng' } }) assert record == { 'title': { 'maintitle': 'Neuchâtel mon amour', 'subtitle': 'Subtitle', 'lang': 'en', 'full': 'Neuchâtel mon amour Subtitle' } }
def test_from_marc(self): record = marc2record({ '919__': { 'a': 'HES-SO Valais', 'b': 'Sion' }, '980__': { 'b': 'HEVS_', 'a': 'BOOK' } }) assert record.get('institution') == { 'name': 'HES-SO Valais', 'code': 'HEVS_', 'locality': 'Sion' }
def test_from_marc(self): record = marc2record({ '711__': { 'a': 'Name', 'c': 'Location', 'd': '2015', 'n': '34' } }) assert record.get('meeting') == { 'name': 'Name', 'location': 'Location', 'date': '2015', 'number': '34', 'full': 'Name 34 2015 Location' }
def test_from_marc(): record = marc2record({ '919__': { 'a': 'HES-SO Valais', 'b': 'Sion' }, '980__': { 'b': 'HEVS_', 'a': 'BOOK' } }) assert record.get('institution') == { 'name': 'HES-SO Valais', 'code': 'HEVS_', 'locality': 'Sion' }
def test_from_marc(): record = marc2record({ '533__': { 'a': 'Type', 'b': 'Location', 'c': 'Agency', 'd': '2015.' } }) assert record.get('reproduction') == { 'type': 'Type', 'location': 'Location', 'agency': 'Agency', 'date': '2015.', 'full': 'Type Location Agency 2015.' }
def test_from_marc(self): record = marc2record({ '245__': { 'a': 'Main Title', 'b': "Subtitle", '9': 'eng' } }) assert record == { 'title': { 'maintitle': 'Main Title', 'subtitle': 'Subtitle', 'lang': 'en', 'full': 'Main Title Subtitle' } }
def test_first_author_from_marc(self): record = marc2record({ '100__': { 'a': 'LastName, FirstName', 'd': '1971-', 'e': 'Dir.', 'u': 'Affiliation' } }) assert record == { 'authors': [{ 'name': 'LastName, FirstName', 'date': '1971-', 'role': 'Dir.', 'affiliation': 'Affiliation', 'full': 'LastName, FirstName 1971-' }] }
def test_from_marc(self): record = marc2record({ '260__': { 'a': 'Location', 'b': 'Publisher', 'c': '2015-', 'e': 'Print Location', 'f': 'Printer' } }) assert record.get('publication') == { 'location': 'Location', 'publisher': 'Publisher', 'date': '2015-', 'print_location': 'Print Location', 'printer': 'Printer', 'full': 'Location Publisher 2015- Print Location Printer' }
def test_multiple_authors_from_marc(self): record = marc2record({ '100__': { 'a': 'LastName, FirstName', 'd': '1971-', 'u': 'Affiliation' }, '700__': [{ 'a': 'LastName2, FirstName2', 'd': '1972-', 'e': 'Dir.', 'u': 'Affiliation2' }, { 'a': 'LastName3, FirstName3', 'd': '1974-', 'e': 'Codir.', 'u': 'Affiliation' }] }) assert record == { 'authors': [{ 'name': 'LastName, FirstName', 'date': '1971-', 'affiliation': 'Affiliation', 'full': 'LastName, FirstName 1971-' }, { 'name': 'LastName2, FirstName2', 'date': '1972-', 'role': 'Dir.', 'affiliation': 'Affiliation2', 'full': 'LastName2, FirstName2 1972-' }, { 'name': 'LastName3, FirstName3', 'date': '1974-', 'affiliation': 'Affiliation', 'role': 'Codir.', 'full': 'LastName3, FirstName3 1974-' }] }
def test_from_marc(self): record = marc2record({ '8564_': [{ 'f': 'file_name.pdf', 'q': 'application/pdf', 's': '1014', 'u': 'http://doc.rero.ch/record/file_name.pdf', 'y': 'order:1', 'z': 'Main file' }] }) assert record == { 'document': [{ 'name': 'file_name.pdf', 'mime': 'application/pdf', 'size': 1014, 'url': 'http://doc.rero.ch/record/file_name.pdf', 'order': 1, 'label': 'Main file' }] }
def test_from_marc(self): record = marc2record({"246__": {"a": "Other Title", "9": "eng"}}) assert record == {"other_title": {"maintitle": "Other Title", "lang": "en", "full": "Other Title"}}
def test_from_marc(self): record = marc2record({ '041__': {'a': 'eng'} }) assert record.get('language') == 'en'
def test_from_marc(self): record = marc2record({ '505__': [{'a': 'Note Line 1\n Line 2'}] }) assert record.get('content_note') == ['Note Line 1\n Line 2']