当前位置: 首页>>代码示例>>Python>>正文


Python Record.subjects方法代码示例

本文整理汇总了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)
开发者ID:gsf,项目名称:pymarc,代码行数:16,代码来源:record.py

示例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)
开发者ID:acdha,项目名称:pymarc,代码行数:19,代码来源:record.py


注:本文中的pymarc.record.Record.subjects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。