Beispiel #1
0
 def test_get_fields(self):
     filename = '%s/onquietcomedyint00brid_meta.mrc' % test_data
     with open(filename, 'rb') as f:
         rec = MarcBinary(f.read())
         rec.build_fields(['100', '245', '010'])
         author_field = rec.get_fields('100')
         assert isinstance(author_field, list)
         assert isinstance(author_field[0], BinaryDataField)
         name = author_field[0].get_subfields('a')
 def test_get_subfield_value(self):
     filename = '%s/onquietcomedyint00brid_meta.mrc' % test_data
     with open(filename, 'rb') as f:
         rec = MarcBinary(f.read())
         rec.build_fields(['100', '245', '010'])
         author_field = rec.get_fields('100')
         assert isinstance(author_field, list)
         assert isinstance(author_field[0], BinaryDataField)
         subfields = author_field[0].get_subfields('a')
         assert next(subfields) == (
             'a', 'Bridgham, Gladys Ruth. [from old catalog]')
         values = author_field[0].get_subfield_values('a')
         name, = values  # 100$a is non-repeatable, there will be only one
         assert name == 'Bridgham, Gladys Ruth. [from old catalog]'