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


Python BibWorkflowObject.extra_data方法代码示例

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


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

示例1: test_filtering

# 需要导入模块: from invenio.modules.workflows.models import BibWorkflowObject [as 别名]
# 或者: from invenio.modules.workflows.models.BibWorkflowObject import extra_data [as 别名]
    def test_filtering(self):
        """Test filtering functionality."""
        from ..tasks.harvesting import filtering_oai_pmh_identifier
        from invenio.modules.workflows.api import start
        from invenio.modules.workflows.models import BibWorkflowObject

        my_test_obj = BibWorkflowObject()
        my_test_obj.set_data("<record><test></test>"
                             "<identifier>identifier1</identifier></record>")
        my_test_obj.save()

        my_test_obj_b = BibWorkflowObject()
        my_test_obj_b.set_data(["<record><test></test><identifier>identifier2"
                                "</identifier></record>"])
        my_test_obj_b.save()
        engine = start("test_workflow_dummy",
                       my_test_obj,
                       module_name="unit_tests")

        # Initialize these attributes to simulate task running in workflows
        my_test_obj.data = my_test_obj.get_data()
        my_test_obj.extra_data = my_test_obj.get_extra_data()
        my_test_obj_b.data = my_test_obj_b.get_data()
        my_test_obj_b.extra_data = my_test_obj_b.get_extra_data()
        engine.extra_data = engine.get_extra_data()

        # Try to add an identifier
        self.assertTrue(filtering_oai_pmh_identifier(my_test_obj, engine))

        # Update engine with the added identifier
        engine.set_extra_data(engine.extra_data)
        engine.extra_data = engine.get_extra_data()

        # False because it is already added
        self.assertFalse(filtering_oai_pmh_identifier(my_test_obj, engine))
        engine.set_extra_data(engine.extra_data)
        engine.extra_data = engine.get_extra_data()

        self.assertTrue(filtering_oai_pmh_identifier(my_test_obj_b, engine))
        engine.set_extra_data(engine.extra_data)
        engine.extra_data = engine.get_extra_data()

        # False because it is already added
        self.assertFalse(filtering_oai_pmh_identifier(my_test_obj_b, engine))
        engine.set_extra_data(engine.extra_data)
        engine.extra_data = engine.get_extra_data()
开发者ID:SCOAP3,项目名称:invenio,代码行数:48,代码来源:test_tasks.py

示例2: test_init_harvesting

# 需要导入模块: from invenio.modules.workflows.models import BibWorkflowObject [as 别名]
# 或者: from invenio.modules.workflows.models.BibWorkflowObject import extra_data [as 别名]
    def test_init_harvesting(self):
        """Test harvesting."""
        from ..tasks.harvesting import init_harvesting
        from invenio.modules.workflows.api import start
        from invenio.modules.workflows.models import BibWorkflowObject

        my_test_obj = BibWorkflowObject()
        my_test_obj.set_data([2])
        my_test_obj.save()
        engine = start("test_workflow_dummy", my_test_obj, module_name="unit_tests")
        my_test_obj.data = my_test_obj.get_data()
        my_test_obj.extra_data = my_test_obj.get_extra_data()
        engine.set_extra_data_params(options={"test": True})
        engine.extra_data = engine.get_extra_data()
        init_harvesting(my_test_obj, engine)
        self.assertTrue(engine.get_extra_data()["options"]["test"])
开发者ID:k3njiy,项目名称:invenio,代码行数:18,代码来源:test_tasks.py


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