Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_title(self):
record = Record()
self.assertEqual(record.title(), None)
record.add_field(Field("245", [0, 1], subfields=["a", "Foo :", "b", "bar"]))
self.assertEqual(record.title(), "Foo : bar")
record = Record()
record.add_field(Field("245", [0, 1], subfields=["a", "Farghin"]))
self.assertEqual(record.title(), "Farghin")
def test_as_marc_consistency(self):
record = Record()
leadertype = type(record.leader)
record.as_marc()
self.assertEqual(leadertype, type(record.leader))
def test_publisher(self):
record = Record()
self.assertEqual(record.publisher(), None)
record.add_field(
Field(
"260",
[" ", " "],
subfields=[
"a",
"Paris :",
"b",
"Gauthier-Villars ;",
"a",
"Chicago :",
"b",
"University of Chicago Press,",
"c",
"1955.",
def test_added_entries(self):
record = Record()
ae1 = "=730 0\\$aTosefta.$lEnglish.$f1977."
ae2 = "=700 10$aLe Peu, Pepe."
aelist = [ae1, ae2]
self.assertEqual(record.addedentries(), [])
record.add_field(
Field(
"730",
[0, " "],
subfields=["a", "Tosefta.", "l", "English.", "f", "1977."],
)
)
record.add_field(Field("700", [1, 0], subfields=["a", "Le Peu, Pepe."]))
record.add_field(Field("245", [0, 0], subfields=["a", "Le Peu's Tosefa."]))
self.assertEqual(len(record.addedentries()), 2)
self.assertEqual(record.addedentries()[0].__str__(), ae1)
self.assertEqual(record.addedentries()[1].__str__(), ae2)
def compile_original_marc(self, r):
marc_record = pymarc.record.Record(force_utf8=True)
marc_record.add_ordered_field(*self.compile_control_fields(r))
marc_record.add_ordered_field(*self.compile_varfields(r))
return marc_record
holdmeta['note'] = rec[1].publicNote.rstrip('\x00')
if hasattr(rec[1], 'circulationData'):
holdmeta['status'] = rec[1].circulationData[0].availableNow
if holdmeta['status'] is True or\
holdmeta['status'] == ' AVAILABLE':
holdmeta['status'] = 'Not Charged'
holdmeta['item_status'] = 1
marc = pymarc.record.Record(zoom_record.data.
bibliographicRecord.encoding[1])
if marc['856']:
holdmeta['url'] = marc['856']['u']
holdmeta['msg'] = marc['856']['z']
holdings.append(holdmeta)
return holdings
if hasattr(zoom_record, 'data'):
marc = pymarc.record.Record(zoom_record.data)
if marc['856']:
holdmeta['url'] = marc['856']['u']
holdmeta['msg'] = marc['856']['z']
holdmeta['callnum'] = ''
holdmeta['status'] = ''
holdmeta['note'] = ''
holdmeta['item_status'] = 0
holdmeta['location'] = ''
holdings.append(holdmeta)
return holdings
else:
return [{'item_status': 0, 'location': '', 'callnum': '',
'status': '', 'url': '', 'note': '', 'msg': ''}]
return [{'item_status': 0, 'location': '', 'callnum': '', 'status': '',
'url': '', 'note': '', 'msg': ''}]