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


Python hamcrest.less_than方法代码示例

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


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

示例1: test_write_memory_abort_does_not_call_commit_delay

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import less_than [as 别名]
def test_write_memory_abort_does_not_call_commit_delay(self, t):
        t.child.timeout = 10
        enable(t)

        t.write("copy running-config startup-config")

        t.readln("")
        t.readln("This operation may take a few minutes.")
        t.readln("Management interfaces will not be available during this time.")
        t.readln("")
        t.read("Are you sure you want to save? (y/n) ")
        t.write_raw("n")
        start_time = time()
        t.readln("")
        t.readln("")
        t.readln("Configuration Not Saved!")
        end_time = time()
        t.read("my_switch#")

        assert_that((end_time - start_time), less_than(COMMIT_DELAY)) 
开发者ID:internap,项目名称:fake-switches,代码行数:22,代码来源:test_enabled_with_commit_delay.py

示例2: test_write_memory_abort_does_not_delay

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import less_than [as 别名]
def test_write_memory_abort_does_not_delay(self, t):
        t.child.timeout = 10
        enable(t)

        t.write("copy running-config startup-config")

        t.readln("")
        t.readln("This operation may take a few minutes.")
        t.readln("Management interfaces will not be available during this time.")
        t.readln("")
        t.read("Are you sure you want to save? (y/n) ")
        t.write_raw("n")
        start_time = time()
        t.readln("")
        t.readln("")
        t.readln("Configuration Not Saved!")
        end_time = time()
        t.read("my_switch#")

        assert_that((end_time - start_time), less_than(COMMIT_DELAY)) 
开发者ID:internap,项目名称:fake-switches,代码行数:22,代码来源:test_enabled_with_commit_delay.py

示例3: step_impl

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import less_than [as 别名]
def step_impl(context):
    time.sleep(15)
    analyzer_job_terminated = False
    analyzer_job_termination_retries = 0

    while not analyzer_job_terminated:
        time.sleep(10)

        analyzer_job_id = context.response['pod_id']
        r = requests.get(f'{context.endpoint_url}/status/{analyzer_job_id}')

        assert_that(r.status_code, equal_to(HTTPStatus.OK))
        assert_that(r.headers['content-type'], equal_to('application/json'))

        response = r.json()
        assert_that(response, not_none)

        if 'terminated' in response['status'].keys():
            if response['status']['terminated']['reason'].startswith('Completed'):
                analyzer_job_terminated = True

        analyzer_job_termination_retries += 1

        assert_that(analyzer_job_termination_retries, less_than(10)) 
开发者ID:thoth-station,项目名称:core,代码行数:26,代码来源:user_api_steps.py

示例4: test__shouldReturnApprovalsOnTimeWhenTooManyWorkflowObject

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import less_than [as 别名]
def test__shouldReturnApprovalsOnTimeWhenTooManyWorkflowObject(self):
        authorized_permission = PermissionObjectFactory()
        authorized_user = UserObjectFactory(user_permissions=[authorized_permission])

        state1 = StateObjectFactory(label="state1")
        state2 = StateObjectFactory(label="state2")

        workflow = WorkflowFactory(initial_state=state1, content_type=self.content_type, field_name="my_field")

        transition_meta = TransitionMetaFactory.create(
            workflow=workflow,
            source_state=state1,
            destination_state=state2,
        )
        TransitionApprovalMetaFactory.create(
            workflow=workflow,
            transition_meta=transition_meta,
            priority=0,
            permissions=[authorized_permission]
        )

        self.objects = BasicTestModelObjectFactory.create_batch(250)
        before = datetime.now()
        BasicTestModel.river.my_field.get_on_approval_objects(as_user=authorized_user)
        after = datetime.now()
        assert_that(after - before, less_than(timedelta(milliseconds=200)))
        print("Time taken %s" % str(after - before)) 
开发者ID:javrasya,项目名称:django-river,代码行数:29,代码来源:test__class_api.py

示例5: test_parameters_can_be_passed_through_the_command_line

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import less_than [as 别名]
def test_parameters_can_be_passed_through_the_command_line(self):
        with GunicornNetmanTestApp() as partial_client:
            client = partial_client(get_available_switch("brocade"))
            start_time = time.time()

            create_session(client, "session_timeouting")

            create_session(client, "session_taking_over")

            result = client.delete("/switches-sessions/session_taking_over")
            assert_that(result.status_code, is_(204), result.text)

            assert_that(time.time() - start_time, is_(less_than(3))) 
开发者ID:internap,项目名称:netman,代码行数:15,代码来源:gunicorn_compatibilty_test.py

示例6: test_timeout_error

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import less_than [as 别名]
def test_timeout_error(self):
        cmd = NaviCommand()
        start = time.time()
        cmd.execute('python'.split(), timeout=0.1)
        dt = time.time() - start
        assert_that(dt, less_than(1)) 
开发者ID:emc-openstack,项目名称:storops,代码行数:8,代码来源:test_navi_command.py

示例7: test__shouldMigrationForIterationMustFinishInShortAmountOfTimeWithTooManyObject

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import less_than [as 别名]
def test__shouldMigrationForIterationMustFinishInShortAmountOfTimeWithTooManyObject(self):
        out = StringIO()
        sys.stout = out
        state1 = StateObjectFactory(label="state1")
        state2 = StateObjectFactory(label="state2")
        state3 = StateObjectFactory(label="state3")
        state4 = StateObjectFactory(label="state4")

        workflow = WorkflowFactory(initial_state=state1, content_type=ContentType.objects.get_for_model(BasicTestModel), field_name="my_field")
        transition_meta_1 = TransitionMetaFactory.create(
            workflow=workflow,
            source_state=state1,
            destination_state=state1,
        )

        transition_meta_2 = TransitionMetaFactory.create(
            workflow=workflow,
            source_state=state2,
            destination_state=state3,
        )

        transition_meta_3 = TransitionMetaFactory.create(
            workflow=workflow,
            source_state=state2,
            destination_state=state4,
        )

        TransitionApprovalMetaFactory.create(
            workflow=workflow,
            transition_meta=transition_meta_1,
            priority=0
        )
        TransitionApprovalMetaFactory.create(
            workflow=workflow,
            transition_meta=transition_meta_2,
            priority=0
        )

        TransitionApprovalMetaFactory.create(
            workflow=workflow,
            transition_meta=transition_meta_2,
            priority=1
        )

        TransitionApprovalMetaFactory.create(
            workflow=workflow,
            transition_meta=transition_meta_3,
            priority=0
        )

        BasicTestModelObjectFactory.create_batch(250)

        call_command('migrate', 'river', '0006', stdout=out)

        before = datetime.now()
        call_command('migrate', 'river', '0007', stdout=out)
        after = datetime.now()
        assert_that(after - before, less_than(timedelta(minutes=5))) 
开发者ID:javrasya,项目名称:django-river,代码行数:60,代码来源:test__migrations.py


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