示例#1
0
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']
        }]
    }
示例#2
0
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'
示例#3
0
def test_simple_from_marc():
    record = marc2record({
        '260__': {'c': '2015'}
    })
    assert record.get("publication_date") == {'to': 2015,
                                              'full': '2015',
                                              'from': 2015}
示例#4
0
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}
示例#5
0
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'
            }
        }]
    }
示例#6
0
def test_from_marc():
    record = marc2record({
        '020__': {
            'a': '9782882250209'
        }
    })
    assert record.get('isbn13') == '9782882250209'
示例#7
0
 def test_from_marc(self):
     record = marc2record({
         '020__': {
             'a': '9782882250209'
         }
     })
     assert record.get('isbn13') == '9782882250209'
示例#8
0
 def test_simple_from_marc(self):
     record = marc2record({
         '300__': {
             'a': '100'
         }
     })
     assert record.get('n_pages') == 100
示例#9
0
 def test_simple_from_marc(self):
     record = marc2record({
         '980__': {
             'a': 'BOOK'
         }
     })
     assert record.get('media_type') == 'http://rdvocab.info/termList/RDAMediaType/1003'
示例#10
0
 def test_from_marc(self):
     record = marc2record({
         '020__': {
             'a': '2-88147-009-2'
         }
     })
     assert record.get('isbn10') == '2-88147-009-2'
示例#11
0
def test_from_marc():
    record = marc2record({'490__': {'a': 'Name', 'v': '3'}})
    assert record.get('series') == {
        'name': 'Name',
        'volume': '3',
        'full': 'Name ; 3'
    }
示例#12
0
def test_from_marc():
    record = marc2record({'250__': {'a': 'Name', 'b': 'Remainder'}})
    assert record == {
        'edition': {
            'statement': 'Name',
            'remainder': 'Remainder'
        }
    }
示例#13
0
 def test_from_marc(self):
     record = marc2record({
         '980__': {'a': 'BOOK', 'f': 'BOOK_PROCEED'}
     })
     assert record.get('document_type') == {
         'main': 'book',
         'sub': 'book_proceed'
     }
示例#14
0
def test_from_marc():
    record = marc2record({'695__': [{'9': 'eng', 'a': 'keyword1 ; keyword2'}]})
    assert record == {
        'keyword': [{
            'lang': 'en',
            'content': ['keyword1', 'keyword2']
        }]
    }
示例#15
0
 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",
     }
示例#16
0
def test_from_marc():
    record = marc2record(
        {'980__': {
            'a': 'BOOK',
            'b': 'MEDVS',
            'f': 'BOOK_PROCEED'
        }})
    assert record.get('type') == {'main': 'book', 'sub': 'book_proceed'}
示例#17
0
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'
    }
示例#18
0
def test_from_marc():
    record = marc2record({'246__': {'a': 'Other Title', '9': 'eng'}})
    assert record == {
        'other_title': {
            'maintitle': 'Other Title',
            'lang': 'en',
            'full': 'Other Title'
        }
    }
示例#19
0
def test_from_marc():
    record = marc2record({'250__': {'a': 'Name', 'b': 'Remainder'}})
    assert record == {
        'edition': {
            'name': 'Name',
            'remainder': 'Remainder',
            'full': 'Name Remainder'
        }
    }
示例#20
0
 def test_from_marc(self):
     record = marc2record({
         '710__': {
             'a': 'Corporate name'
         }
     })
     assert record == {
         'corporate': ['Corporate name']
     }
示例#21
0
 def test_from_marc(self):
     record = marc2record({
         '300__': {
             'c': '150 x 200 cm'
         }
     })
     assert record.get('dimension') == {
         'width': 150,
         'height': 200
     }
示例#22
0
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']
    }
示例#23
0
def test_from_marc():
    record = marc2record({
        '982__': [{
            'a': 'CODE',
            'b': 'Collection Name',
        }]
    })
    assert record.get('specific_collection') == [{
        'code': 'CODE',
        'name': 'Collection Name'
    }]
示例#24
0
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'
     }
示例#26
0
 def test_complete_from_marc(self):
     record = marc2record({
         '260__': {
             'c': '2015-2016'
         }
     })
     assert record.get('publication_date') == {
         'from': 2015,
         'to': 2016,
         'full': '2015-2016'
     }
示例#27
0
 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']
     }
示例#28
0
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'
        }]
    }
示例#29
0
 def test_from_marc(self):
     record = marc2record({
         '490__': {
             'a': 'Name',
             'v': '3'
         }
     })
     assert record.get('series') == {
         'name': 'Name',
         'volume': '3',
         'full': 'Name ; 3'
     }
示例#30
0
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'
        }]
    }
示例#31
0
 def test_from_marc(self):
     record = marc2record({
         '695__': [{
             '9': 'eng',
             'a': 'keyword1 ; keyword2'
         }]
     })
     assert record == {
         'keyword': [{
             'lang': 'en',
             'content': ['keyword1', 'keyword2']
         }]
     }
示例#32
0
 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'
         }]
     }
示例#33
0
 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'
         }
     }
示例#34
0
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'
        }
    }
示例#35
0
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'
    }
示例#36
0
def test_from_marc():
    record = marc2record(
        {'245__': {
            'a': 'Main Title',
            'b': "Subtitle",
            '9': 'eng'
        }})
    assert record == {
        'title': [{
            'main': 'Main Title',
            'sub': 'Subtitle',
            'language': 'en'
        }]
    }
示例#37
0
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'
        }]
    }
示例#38
0
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'
    }
示例#39
0
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'
        }]
    }
示例#40
0
 def test_lcsh_from_marc(self):
     record = marc2record({
         '600__': [{
             '9': '650__',
             'a': 'Inventaires'
         }]
     })
     assert record == {
         'subject': [{
             'vocabulary': 'lcsh',
             'tag': '650__',
             'content': 'Inventaires'
         }]
     }
示例#41
0
def test_lcsh_from_marc():
    record = marc2record({
        '600__': [{
            '9': '650__',
            'a': 'Inventaires'
        }]
    })
    assert record == {
        'subject': [{
            'vocabulary': 'lcsh',
            'tag': '650__',
            'content': 'Inventaires'
        }]
    }
示例#42
0
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.'
    }
示例#43
0
 def test_from_marc(self):
     record = marc2record({
         '250__': {
             'a': 'Name',
             'b': 'Remainder'
         }
     })
     assert record == {
         'edition': {
             'name': 'Name',
             'remainder': 'Remainder',
             'full': 'Name Remainder'
         }
     }
示例#44
0
 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'
         }]
     }
示例#45
0
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'
        }
    }
示例#46
0
 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.'
     }
示例#47
0
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'
    }
示例#48
0
 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'
         }
     }
示例#49
0
 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'
     }
示例#50
0
 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'
     }
示例#51
0
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'
    }
示例#52
0
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.'
    }
示例#53
0
 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'
         }
     }
示例#54
0
 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-'
         }]
     }
示例#55
0
 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'
     }
示例#56
0
 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-'
                     }]
     }
示例#57
0
 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'
         }]
     }
示例#58
0
 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"}}
示例#59
0
 def test_from_marc(self):
     record = marc2record({
         '041__': {'a': 'eng'}
     })
     assert record.get('language') == 'en'
示例#60
0
 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']