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


Python TestFactory.create_group方法代码示例

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


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

示例1: test_set_op_and_group_visibility

# 需要导入模块: from tvb.tests.framework.core.factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.factory.TestFactory import create_group [as 别名]
 def test_set_op_and_group_visibility(self):
     """
     When changing the visibility for an operation that belongs to an operation group, we
     should also change the visibility for the entire group of operations.
     """
     _, group_id = TestFactory.create_group(self.test_user, subject="test-subject-1")
     list_of_operations = dao.get_operations_in_group(group_id)
     for operation in list_of_operations:
         assert operation.visible, "The operation should be visible."
     self.project_service.set_operation_and_group_visibility(list_of_operations[0].gid, False)
     operations = dao.get_operations_in_group(group_id)
     for operation in operations:
         assert not operation.visible, "The operation should not be visible."
开发者ID:maedoc,项目名称:tvb-framework,代码行数:15,代码来源:project_structure_test.py

示例2: _create_datatype_group

# 需要导入模块: from tvb.tests.framework.core.factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.factory.TestFactory import create_group [as 别名]
    def _create_datatype_group(self):
        """
        Creates a project, one DataTypeGroup with 2 DataTypes into the new group.
        """
        test_project = TestFactory.create_project(self.test_user, "NewProject")

        all_operations = dao.get_filtered_operations(test_project.id, None, is_count=True)
        assert 0 == all_operations, "There should be no operation."
        
        datatypes, op_group_id = TestFactory.create_group(self.test_user, test_project)
        dt_group = dao.get_datatypegroup_by_op_group_id(op_group_id)

        return test_project, dt_group.id, datatypes[0], datatypes[1]
开发者ID:maedoc,项目名称:tvb-framework,代码行数:15,代码来源:project_structure_test.py

示例3: test_set_op_group_visibility

# 需要导入模块: from tvb.tests.framework.core.factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.factory.TestFactory import create_group [as 别名]
 def test_set_op_group_visibility(self):
     """
     Tests if the visibility for an operation group is set correct.
     """
     _, group_id = TestFactory.create_group(self.test_user, subject="test-subject-1")
     list_of_operations = dao.get_operations_in_group(group_id)
     for operation in list_of_operations:
         assert operation.visible, "The operation should be visible."
     op_group = dao.get_operationgroup_by_id(group_id)
     self.project_service.set_operation_and_group_visibility(op_group.gid, False, True)
     operations = dao.get_operations_in_group(group_id)
     for operation in operations:
         assert not operation.visible, "The operation should not be visible."
开发者ID:maedoc,项目名称:tvb-framework,代码行数:15,代码来源:project_structure_test.py

示例4: _create_operations_with_inputs

# 需要导入模块: from tvb.tests.framework.core.factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.factory.TestFactory import create_group [as 别名]
    def _create_operations_with_inputs(self, is_group_parent=False):
        """
        Method used for creating a complex tree of operations.

        If 'if_group_parent' is True then a new group will be created and one of its entries it will be used as
        input for the returned operations.
        """
        group_dts, root_op_group_id = TestFactory.create_group(self.test_user, self.test_project)
        if is_group_parent:
            datatype_gid = group_dts[0].gid
        else:
            datatype_gid = TestProjectService._create_value_wrapper(self.test_user, self.test_project)[1]

        parameters = json.dumps({"param_name": datatype_gid})

        ops = []
        for i in range(4):
            ops.append(TestFactory.create_operation(test_user=self.test_user, test_project=self.test_project))
            if i in [1, 3]:
                ops[i].visible = False
            ops[i].parameters = parameters
            ops[i] = dao.store_entity(ops[i])
            
        #groups
        _, ops_group = TestFactory.create_group(self.test_user, self.test_project)
        ops_group = dao.get_operations_in_group(ops_group)
        assert 2 == len(ops_group)
        ops_group[0].parameters = parameters
        ops_group[0] = dao.store_entity(ops_group[0])
        ops_group[1].visible = False
        ops_group[1].parameters = parameters
        ops_group[1] = dao.store_entity(ops_group[1])

        ops.extend(ops_group)
        if is_group_parent:
            dt_group = dao.get_datatypegroup_by_op_group_id(root_op_group_id)
            return ops, dt_group.id
        return ops, datatype_gid
开发者ID:maedoc,项目名称:tvb-framework,代码行数:40,代码来源:project_structure_test.py

示例5: test_update_meta_data_group

# 需要导入模块: from tvb.tests.framework.core.factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.factory.TestFactory import create_group [as 别名]
    def test_update_meta_data_group(self):
        """
        Test the new update metaData for a group of dataTypes.
        """
        datatypes, group_id = TestFactory.create_group(self.test_user, subject="test-subject-1")

        new_meta_data = {DataTypeOverlayDetails.DATA_SUBJECT: "new subject",
                         DataTypeOverlayDetails.DATA_STATE: "updated_state",
                         DataTypeOverlayDetails.CODE_OPERATION_GROUP_ID: group_id,
                         DataTypeOverlayDetails.CODE_OPERATION_TAG: 'newGroupName'}
        self.project_service.update_metadata(new_meta_data)  
          
        for datatype in datatypes:
            new_datatype = dao.get_datatype_by_id(datatype.id)
            assert group_id == new_datatype.parent_operation.fk_operation_group
            new_group = dao.get_generic_entity(model.OperationGroup, group_id)[0]
            assert new_group.name == "newGroupName"
            self.__check_meta_data(new_meta_data, new_datatype)
开发者ID:maedoc,项目名称:tvb-framework,代码行数:20,代码来源:project_service_test.py


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