本文整理汇总了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))
示例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))
示例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))
示例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))
示例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)))
示例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))
示例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)))