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


Python Record.produce方法代码示例

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


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

示例1: test_json_for_ld

# 需要导入模块: from invenio.modules.records.api import Record [as 别名]
# 或者: from invenio.modules.records.api.Record import produce [as 别名]
    def test_json_for_ld(self):
        from invenio.modules.records.api import Record
        r = Record.create({'title': 'Test'}, 'json')

        import copy
        r = Record(json=copy.copy(test_record), master_format='marc')
        r.produce('json_for_ld')
开发者ID:bruno314,项目名称:zenodo,代码行数:9,代码来源:test_jsonext.py

示例2: test_marc_export

# 需要导入模块: from invenio.modules.records.api import Record [as 别名]
# 或者: from invenio.modules.records.api.Record import produce [as 别名]
    def test_marc_export(self):
        from invenio.modules.records.api import Record
        from invenio.legacy.bibrecord import create_record, record_xml_output

        rec = Record(json=test_record, master_format='marc')

        # Needed to properly set authors when generating MARC
        first = rec['authors'][0]
        additional = rec['authors'][1:]
        rec['_first_author'] = first
        rec['_additional_authors'] = additional

        output_marc = record_xml_output(
            create_record(rec.legacy_export_as_marc())[0]
        )
        try:
            self.assertEqual(test_marc, output_marc)
        except AssertionError:
            # Print diff in case of errors.
            import difflib
            diff = "".join(difflib.unified_diff(
                test_marc.splitlines(1),
                output_marc.splitlines(1)
            ))
            raise AssertionError(diff)

        form_json = rec.produce('json_for_form')
        for k, v in test_form_json.items():
            self.assertEqual(form_json[k], test_form_json[k])
开发者ID:SDSG-Invenio,项目名称:zenodo,代码行数:31,代码来源:test_jsonext.py

示例3: test_json_for_ld

# 需要导入模块: from invenio.modules.records.api import Record [as 别名]
# 或者: from invenio.modules.records.api.Record import produce [as 别名]
    def test_json_for_ld(self):
        from invenio.modules.records.api import Record

        r = Record.create({"title": "Test"}, "json")

        import copy

        r = Record(json=copy.copy(test_record), master_format="marc")

        ld = r.produce("json_for_ld")
        print(ld)
开发者ID:LibrarPotter,项目名称:zenodo,代码行数:13,代码来源:test_jsonext.py

示例4: test_json_for_form

# 需要导入模块: from invenio.modules.records.api import Record [as 别名]
# 或者: from invenio.modules.records.api.Record import produce [as 别名]
    def test_json_for_form(self):
        from invenio.modules.records.api import Record
        r = Record.create({'title': 'Test'}, 'json')
        assert r.produce('json_for_form')['title'] == 'Test'
        assert {'245__a': 'Test'} in r.produce('json_for_marc')

        import copy
        r = Record(json=copy.copy(test_record), master_format='marc')

        form_json = r.produce('json_for_form')
        for k, v in test_form_json.items():
            self.assertEqual(form_json[k], test_form_json[k])
开发者ID:SDSG-Invenio,项目名称:zenodo,代码行数:14,代码来源:test_jsonext.py

示例5: test_marc_export

# 需要导入模块: from invenio.modules.records.api import Record [as 别名]
# 或者: from invenio.modules.records.api.Record import produce [as 别名]
    def test_marc_export(self):
        from invenio.modules.records.api import Record
        #from invenio.legacy.bibrecord import create_record

        r = Record(json=test_record, master_format='marc')
        # self.assertEqual(
        #     r.legacy_create_recstruct(),
        #     create_record(test_marc)[0],
        # )

        form_json = r.produce('json_for_form')
        for k, v in test_form_json.items():
            self.assertEqual(form_json[k], test_form_json[k])
开发者ID:suso2,项目名称:zenodo,代码行数:15,代码来源:test_jsonext.py


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