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


Python Build._all_subjobs_by_id[subjob_id]方法代码示例

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


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

示例1: test_subjobs_with_pagination_request

# 需要导入模块: from app.master.build import Build [as 别名]
# 或者: from app.master.build.Build import _all_subjobs_by_id[subjob_id] [as 别名]
    def test_subjobs_with_pagination_request(
            self,
            offset: Optional[int],
            limit: Optional[int],
            expected_first_subjob_id: int,
            expected_last_subjob_id: int,
            ):
        build = Build(BuildRequest({}))
        # Create 20 mock subjobs with ids 1 to 20
        for subjob_id in range(1, self._NUM_SUBJOBS + 1):
            subjob_mock = Mock(spec=Subjob)
            subjob_mock.subjob_id = subjob_id
            build._all_subjobs_by_id[subjob_id] = subjob_mock

        requested_subjobs = build.get_subjobs(offset, limit)

        id_of_first_subjob = requested_subjobs[0].subjob_id if len(requested_subjobs) else None
        id_of_last_subjob = requested_subjobs[-1].subjob_id if len(requested_subjobs) else None
        num_subjobs = len(requested_subjobs)

        self.assertEqual(id_of_first_subjob, expected_first_subjob_id, 'Received the wrong first subjob from request')
        self.assertEqual(id_of_last_subjob, expected_last_subjob_id, 'Received the wrong last subjob from request')
        if offset is not None and limit is not None:
            self.assertLessEqual(num_subjobs, self._PAGINATION_MAX_LIMIT, 'Received too many subjobs from request')
开发者ID:box,项目名称:ClusterRunner,代码行数:26,代码来源:test_cluster_master.py


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