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


Python Record.get_fields方法代码示例

本文整理汇总了Python中pymarc.record.Record.get_fields方法的典型用法代码示例。如果您正苦于以下问题:Python Record.get_fields方法的具体用法?Python Record.get_fields怎么用?Python Record.get_fields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pymarc.record.Record的用法示例。


在下文中一共展示了Record.get_fields方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_remove_fields

# 需要导入模块: from pymarc.record import Record [as 别名]
# 或者: from pymarc.record.Record import get_fields [as 别名]
 def test_remove_fields(self):
     with open("test/testunimarc.dat", "rb") as fh:
         record = Record(fh.read(), force_utf8=True)
     self.assertTrue(len(record.get_fields("899")) != 0)
     self.assertTrue(len(record.get_fields("702")) != 0)
     record.remove_fields("899", "702")
     self.assertTrue(len(record.get_fields("899")) == 0)
     self.assertTrue(len(record.get_fields("702")) == 0)
开发者ID:cshintov,项目名称:pymarc,代码行数:10,代码来源:record.py

示例2: test_remove_fields

# 需要导入模块: from pymarc.record import Record [as 别名]
# 或者: from pymarc.record.Record import get_fields [as 别名]
 def test_remove_fields(self):
     with open('test/testunimarc.dat', 'rb') as fh:
         record = Record(fh.read(), force_utf8=True)
     self.assertTrue(len(record.get_fields('899'))!=0)
     self.assertTrue(len(record.get_fields('702'))!=0)
     record.remove_fields('899', '702')
     self.assertTrue(len(record.get_fields('899'))==0)
     self.assertTrue(len(record.get_fields('702'))==0)
开发者ID:stancikcom,项目名称:pymarc,代码行数:10,代码来源:record.py

示例3: test_find

# 需要导入模块: from pymarc.record import Record [as 别名]
# 或者: from pymarc.record.Record import get_fields [as 别名]
 def test_find(self):
     record = Record()
     subject1 = Field(tag="650", indicators=["", "0"], subfields=["a", "Programming Language"])
     record.add_field(subject1)
     subject2 = Field(tag="650", indicators=["", "0"], subfields=["a", "Object Oriented"])
     record.add_field(subject2)
     found = record.get_fields("650")
     self.assertEqual(found[0], subject1, "get_fields() item 1")
     self.assertEqual(found[0], subject1, "get_fields() item 2")
     found = record.get_fields()
     self.assertEqual(len(found), 2, "get_fields() with no tag")
开发者ID:gsf,项目名称:pymarc,代码行数:13,代码来源:record.py

示例4: test_multi_find

# 需要导入模块: from pymarc.record import Record [as 别名]
# 或者: from pymarc.record.Record import get_fields [as 别名]
 def test_multi_find(self):
     record = Record()
     subject1 = Field(tag="650", indicators=["", "0"], subfields=["a", "Programming Language"])
     record.add_field(subject1)
     subject2 = Field(tag="651", indicators=["", "0"], subfields=["a", "Object Oriented"])
     record.add_field(subject2)
     found = record.get_fields("650", "651")
     self.assertEquals(len(found), 2)
开发者ID:gsf,项目名称:pymarc,代码行数:10,代码来源:record.py

示例5: test_find

# 需要导入模块: from pymarc.record import Record [as 别名]
# 或者: from pymarc.record.Record import get_fields [as 别名]
 def test_find(self):
     record = Record() 
     subject1 = Field(
         tag = '650', 
         indicators = ['', '0'], 
         subfields = ['a', 'Programming Language'])
     record.add_field(subject1)
     subject2 = Field(
         tag = '650', 
         indicators = ['', '0'], 
         subfields = ['a', 'Object Oriented'])
     record.add_field(subject2)
     found = record.get_fields('650')
     self.assertEqual(found[0], subject1, 'get_fields() item 1')
     self.assertEqual(found[0], subject1, 'get_fields() item 2')
     found = record.get_fields()
     self.assertEqual(len(found), 2, 'get_fields() with no tag')
开发者ID:acdha,项目名称:pymarc,代码行数:19,代码来源:record.py

示例6: test_alphatag

# 需要导入模块: from pymarc.record import Record [as 别名]
# 或者: from pymarc.record.Record import get_fields [as 别名]
 def test_alphatag(self):
     record = Record()
     record.add_field(Field("CAT", [" ", " "], subfields=["a", "foo"]))
     record.add_field(Field("CAT", [" ", " "], subfields=["b", "bar"]))
     fields = record.get_fields("CAT")
     self.assertEqual(len(fields), 2)
     self.assertEqual(fields[0]["a"], "foo")
     self.assertEqual(fields[1]["b"], "bar")
     self.assertEqual(record["CAT"]["a"], "foo")
开发者ID:gsf,项目名称:pymarc,代码行数:11,代码来源:record.py

示例7: test_multi_find

# 需要导入模块: from pymarc.record import Record [as 别名]
# 或者: from pymarc.record.Record import get_fields [as 别名]
 def test_multi_find(self):
     record = Record() 
     subject1 = Field(
         tag = '650', 
         indicators = ['', '0'], 
         subfields = ['a', 'Programming Language'])
     record.add_field(subject1)
     subject2 = Field(
         tag = '651', 
         indicators = ['', '0'], 
         subfields = ['a', 'Object Oriented'])
     record.add_field(subject2)
     found = record.get_fields('650', '651')
     self.assertEqual(len(found), 2)
开发者ID:acdha,项目名称:pymarc,代码行数:16,代码来源:record.py


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