def test_bib_with_vendor_910_tag(self): bib = Record() bib.add_field( Field(tag="910", indicators=[" ", " "], subfields=["a", "foo"])) patches.bib_patches("nypl", "research", "acq", "Amalivre", bib) tags_910 = bib.get_fields("910") self.assertEqual(len(tags_910), 1) self.assertEqual(str(bib["910"]), "=910 \\\\$aRL")
def test_nypl_branch_BT_SERIES_Spanish_prefix(self): bib = Record() bib.leader = "00000nam a2200000u 4500" tags = [] tags.append(Field(tag="001", data="0001")) tags.append( Field(tag="245", indicators=["0", "0"], subfields=["a", "Test title"])) tags.append( Field( tag="091", indicators=[" ", " "], subfields=["a", "J SPA E COMPOUND NAME"], )) for tag in tags: bib.add_ordered_field(tag) mod_bib = patches.bib_patches("nypl", "branches", "cat", "BT SERIES", bib) correct_indicators = [" ", " "] correct_subfields = ["p", "J SPA", "a", "E", "c", "COMPOUND NAME"] self.assertEqual(correct_indicators, mod_bib.get_fields("091")[0].indicators) self.assertEqual(correct_subfields, mod_bib.get_fields("091")[0].subfields)
def test_nypl_branches_BT_SERIES_YA_graphic_novel_compound_name(self): bib = Record() bib.leader = "00000nam a2200000u 4500" tags = [] tags.append(Field(tag="001", data="0001")) tags.append( Field(tag="245", indicators=["0", "0"], subfields=["a", "Test title"])) tags.append( Field( tag="091", indicators=[" ", " "], subfields=["a", "GRAPHIC GN FIC COMPOUND NAME"], )) for tag in tags: bib.add_ordered_field(tag) mod_bib = patches.bib_patches("nypl", "branches", "cat", "BT SERIES", bib) correct_indicators = [" ", " "] correct_subfields = [ "f", "GRAPHIC", "a", "GN FIC", "c", "COMPOUND NAME" ] self.assertEqual(correct_indicators, mod_bib.get_fields("091")[0].indicators) self.assertEqual(correct_subfields, mod_bib.get_fields("091")[0].subfields)
def test_nypl_branch_BT_SERIES_exception(self): bib = Record() bib.leader = "00000nam a2200000u 4500" tags = [] tags.append(Field(tag="001", data="0001")) tags.append( Field(tag="245", indicators=["0", "0"], subfields=["a", "Test title"])) tags.append( Field(tag="091", indicators=[" ", " "], subfields=["a", "J B EDISON C"])) for tag in tags: bib.add_ordered_field(tag) with self.assertRaises(AssertionError): patches.bib_patches("nypl", "branches", "cat", "BT SERIES", bib)
def test_bib_no_oclc_prefix(self): bib = Record() bib.leader = "00000nam a2200000u 4500" tags = [] tags.append(Field(tag="001", data="bl00000001")) tags.append( Field(tag="245", indicators=["0", "0"], subfields=["a", "Test title"])) tags.append( Field( tag="091", indicators=[" ", " "], subfields=["a", "GRAPHIC GN FIC COMPOUND NAME"], )) for tag in tags: bib.add_ordered_field(tag) mod_bib = patches.bib_patches("nypl", "branches", "cat", "Amalivre", bib) self.assertEqual(mod_bib.get_fields("001")[0].data, "bl00000001")
def test_bib_without_vendor_910_tag(self): bib = Record() patches.bib_patches("nypl", "branches", "cat", "BT SERIES", bib) tags_910 = bib.get_fields("910") self.assertEqual(len(tags_910), 1) self.assertEqual(str(bib["910"]), "=910 \\\\$aBL")