Python hamcrest.less_than() Examples
The following are 7
code examples of hamcrest.less_than().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
hamcrest
, or try the search function
.
Example #1
Source File: test_enabled_with_commit_delay.py From fake-switches with Apache License 2.0 | 6 votes |
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))
Example #2
Source File: test_enabled_with_commit_delay.py From fake-switches with Apache License 2.0 | 6 votes |
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))
Example #3
Source File: user_api_steps.py From core with GNU General Public License v3.0 | 6 votes |
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))
Example #4
Source File: test__class_api.py From django-river with BSD 3-Clause "New" or "Revised" License | 5 votes |
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))
Example #5
Source File: gunicorn_compatibilty_test.py From netman with Apache License 2.0 | 5 votes |
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)))
Example #6
Source File: test_navi_command.py From storops with Apache License 2.0 | 5 votes |
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))
Example #7
Source File: test__migrations.py From django-river with BSD 3-Clause "New" or "Revised" License | 4 votes |
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)))