本文整理汇总了Python中pymarc.record.Record.as_marc方法的典型用法代码示例。如果您正苦于以下问题:Python Record.as_marc方法的具体用法?Python Record.as_marc怎么用?Python Record.as_marc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymarc.record.Record
的用法示例。
在下文中一共展示了Record.as_marc方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_init_with_leader
# 需要导入模块: from pymarc.record import Record [as 别名]
# 或者: from pymarc.record.Record import as_marc [as 别名]
def test_init_with_leader(self):
"""
Test creating a Record with a leader argument.
"""
record = Record(leader="abcdefghijklmnopqrstuvwx")
record.add_field(Field(tag="245", indicators=["0", "1"], subfields=["a", "The pragmatic programmer"]))
transmission_format = record.as_marc()
transmission_format_leader = transmission_format[0:24]
self.assertEqual(transmission_format_leader, b"00067fghij2200037rst4500")
示例2: test_init_with_no_leader
# 需要导入模块: from pymarc.record import Record [as 别名]
# 或者: from pymarc.record.Record import as_marc [as 别名]
def test_init_with_no_leader(self):
"""
Test creating a Record object with no leader argument.
"""
record = Record()
record.add_field(Field(tag="245", indicators=["0", "1"], subfields=["a", "The pragmatic programmer"]))
transmission_format = record.as_marc()
transmission_format_leader = transmission_format[0:24]
self.assertEqual(transmission_format_leader, b"00067 2200037 4500")
示例3: test_as_marc_with_explicit_leader
# 需要导入模块: from pymarc.record import Record [as 别名]
# 或者: from pymarc.record.Record import as_marc [as 别名]
def test_as_marc_with_explicit_leader(self):
"""
Test setting an explicit leader.
as_marc() should use the whole leader as set.
"""
record = Record()
record.add_field(Field(tag="245", indicators=["0", "1"], subfields=["a", "The pragmatic programmer"]))
record.leader = "00067 2200037 4500"
leader_not_touched = record.leader
transmission_format = record.as_marc()
leader_touched = record.leader
self.assertTrue(leader_not_touched == leader_touched)
示例4: test_as_marc_leader
# 需要导入模块: from pymarc.record import Record [as 别名]
# 或者: from pymarc.record.Record import as_marc [as 别名]
def test_as_marc_leader(self):
record = Record()
record.add_field(
Field(
tag = '245',
indicators = ['0','1'],
subfields = ['a', 'The pragmatic programmer']))
record.leader = '00067 2200037 4500'
leader_not_touched = record.leader
transmission_format = record.as_marc()
leader_touched = record.leader
self.assertTrue(leader_not_touched==leader_touched)
示例5: test_as_marc_consistency
# 需要导入模块: from pymarc.record import Record [as 别名]
# 或者: from pymarc.record.Record import as_marc [as 别名]
def test_as_marc_consistency(self):
record = Record()
leadertype = type(record.leader)
record.as_marc()
self.assertEqual(leadertype, type(record.leader))