예제 #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'
    }
예제 #25
0
 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']