本文整理汇总了Python中pymarc.record.Record.subjects方法的典型用法代码示例。如果您正苦于以下问题:Python Record.subjects方法的具体用法?Python Record.subjects怎么用?Python Record.subjects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymarc.record.Record
的用法示例。
在下文中一共展示了Record.subjects方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_subjects
# 需要导入模块: from pymarc.record import Record [as 别名]
# 或者: from pymarc.record.Record import subjects [as 别名]
def test_subjects(self):
record = Record()
subject1 = "=630 0\\$aTosefta.$lEnglish.$f1977."
subject2 = "=600 10$aLe Peu, Pepe."
shlist = [subject1, subject2]
self.assertEquals(record.subjects(), [])
record.add_field(Field("630", [0, " "], subfields=["a", "Tosefta.", "l", "English.", "f", "1977."]))
record.add_field(Field("730", [0, " "], subfields=["a", "Tosefta.", "l", "English.", "f", "1977."]))
record.add_field(Field("600", [1, 0], subfields=["a", "Le Peu, Pepe."]))
self.assertEquals(len(record.subjects()), 2)
self.assertEquals(record.subjects()[0].__str__(), subject1)
self.assertEquals(record.subjects()[1].__str__(), subject2)
rshlist = [rsh.__str__() for rsh in record.subjects()]
self.assertEquals(shlist, rshlist)
示例2: test_subjects
# 需要导入模块: from pymarc.record import Record [as 别名]
# 或者: from pymarc.record.Record import subjects [as 别名]
def test_subjects(self):
record = Record()
subject1 = '=630 0\\$aTosefta.$lEnglish.$f1977.'
subject2 = '=600 10$aLe Peu, Pepe.'
shlist = [subject1, subject2]
self.assertEqual(record.subjects(), [])
record.add_field(Field('630', [0, ' '],
subfields=['a', "Tosefta.", 'l', "English.", 'f', "1977."]))
record.add_field(Field('730', [0, ' '],
subfields=['a', "Tosefta.", 'l', "English.", 'f', "1977."]))
record.add_field(Field('600', [1, 0],
subfields=['a', "Le Peu, Pepe."]))
self.assertEqual(len(record.subjects()), 2)
self.assertEqual(record.subjects()[0].__str__(), subject1)
self.assertEqual(record.subjects()[1].__str__(), subject2)
rshlist = [rsh.__str__() for rsh in record.subjects()]
self.assertEqual(shlist, rshlist)