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


Python hamcrest.not_none方法代码示例

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


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

示例1: validate_response

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import not_none [as 别名]
def validate_response(context):
    assert_that(context.response.status_code, equal_to(HTTPStatus.OK))
    response_data = json.loads(context.response.data)
    expected_response = ['tell me a joke']
    assert_that(response_data, equal_to(expected_response))

    resources_dir = os.path.join(os.path.dirname(__file__), 'resources')
    with open(os.path.join(resources_dir, 'test_stt.flac'), 'rb') as input_file:
        input_file_content = input_file.read()
    flac_file_path = _get_stt_result_file(context.account.id, '.flac')
    assert_that(flac_file_path, not_none())
    with open(flac_file_path, 'rb') as output_file:
        output_file_content = output_file.read()
    assert_that(input_file_content, equal_to(output_file_content))

    stt_file_path = _get_stt_result_file(context.account.id, '.stt')
    assert_that(stt_file_path, not_none())
    with open(stt_file_path, 'rb') as output_file:
        output_file_content = output_file.read()
    assert_that(b'tell me a joke', equal_to(output_file_content)) 
开发者ID:MycroftAI,项目名称:selene-backend,代码行数:22,代码来源:get_utterance.py

示例2: step_impl

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import not_none [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

示例3: check_db_for_account

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import not_none [as 别名]
def check_db_for_account(context):
    acct_repository = AccountRepository(context.db)
    account = acct_repository.get_account_by_email('bar@mycroft.ai')
    # add account to context so it will deleted by cleanup step
    context.accounts['bar'] = account
    assert_that(account, not_none())
    assert_that(
        account.email_address, equal_to('bar@mycroft.ai')
    )

    assert_that(len(account.agreements), equal_to(2))
    for agreement in account.agreements:
        assert_that(agreement.type, is_in((PRIVACY_POLICY, TERMS_OF_USE)))
        assert_that(agreement.accept_date, equal_to(str(date.today()))) 
开发者ID:MycroftAI,项目名称:selene-backend,代码行数:16,代码来源:add_account.py

示例4: validate_response

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import not_none [as 别名]
def validate_response(context):
    device_id = context.response.data.decode()
    account = context.accounts['foo']
    db = connect_to_db(context.client_config['DB_CONNECTION_CONFIG'])
    device_repository = DeviceRepository(db)
    device = device_repository.get_device_by_id(device_id)

    assert_that(device, not_none())
    assert_that(device.name, equal_to('Selene Test Device'))
    assert_that(device.placement, equal_to('Mycroft Offices'))
    assert_that(device.account_id, equal_to(account.id)) 
开发者ID:MycroftAI,项目名称:selene-backend,代码行数:13,代码来源:add_device.py

示例5: validate_etag

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import not_none [as 别名]
def validate_etag(context):
    response = context.get_location_response
    new_location_etag = response.headers.get('ETag')
    assert_that(new_location_etag, not_none())
    assert_that(new_location_etag, is_not(context.expired_location_etag)) 
开发者ID:MycroftAI,项目名称:selene-backend,代码行数:7,代码来源:device_location.py

示例6: get_new_skill

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import not_none [as 别名]
def get_new_skill(context):
    skill_repo = SkillRepository(context.db)
    skill = skill_repo.get_skill_by_global_id(
        context.new_skill.skill_gid
    )
    assert_that(skill, is_(not_none())) 
开发者ID:MycroftAI,项目名称:selene-backend,代码行数:8,代码来源:device_skill_manifest.py

示例7: check_device_last_contact

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import not_none [as 别名]
def check_device_last_contact(context):
    key = DEVICE_LAST_CONTACT_KEY.format(device_id=context.device_id)
    value = context.cache.get(key).decode()
    assert_that(value, not_none())

    last_contact_ts = datetime.strptime(value, '%Y-%m-%d %H:%M:%S.%f')
    assert_that(last_contact_ts.date(), equal_to(datetime.utcnow().date())) 
开发者ID:MycroftAI,项目名称:selene-backend,代码行数:9,代码来源:common.py

示例8: fetch_device_expired_etag

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import not_none [as 别名]
def fetch_device_expired_etag(context):
    etag = context.device_etag
    assert_that(etag, not_none())
    access_token = context.device_login['accessToken']
    device_uuid = context.device_login['uuid']
    headers = {
        'Authorization': 'Bearer {token}'.format(token=access_token),
        'If-None-Match': etag
    }
    context.response_using_invalid_etag = context.client.get(
        '/v1/device/{uuid}'.format(uuid=device_uuid),
        headers=headers
    ) 
开发者ID:MycroftAI,项目名称:selene-backend,代码行数:15,代码来源:get_device.py

示例9: test_tables_broken_schema

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import not_none [as 别名]
def test_tables_broken_schema(self, simpsons_broken_dataset):
        assert_that(calling(simpsons_broken_dataset.tables.get).with_args(
            'simpsons_episodes'), not_(raises(Exception)))
        assert_that(simpsons_broken_dataset.tables.get('simpsons_episodes'),
                    not_none()) 
开发者ID:datadotworld,项目名称:data.world-py,代码行数:7,代码来源:test_dataset.py

示例10: test_dataframe_broken_schema

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import not_none [as 别名]
def test_dataframe_broken_schema(self, simpsons_broken_dataset):
        assert_that(calling(simpsons_broken_dataset.dataframes.get).with_args(
            'simpsons_episodes'), not_(raises(Exception)))
        assert_that(simpsons_broken_dataset.dataframes.get(
            'simpsons_episodes'), not_none()) 
开发者ID:datadotworld,项目名称:data.world-py,代码行数:7,代码来源:test_dataset.py

示例11: test_vnx_availability

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import not_none [as 别名]
def test_vnx_availability(self):
        vnx = storops.VNXSystem('10.244.211.30', heartbeat_interval=0)
        assert_that(vnx, not_none()) 
开发者ID:emc-openstack,项目名称:storops,代码行数:5,代码来源:__init__.py

示例12: test_unity_availability

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import not_none [as 别名]
def test_unity_availability(self):
        unity = storops.UnitySystem('1.1.1.1', 'admin', 'password')
        assert_that(unity, not_none()) 
开发者ID:emc-openstack,项目名称:storops,代码行数:5,代码来源:__init__.py

示例13: test_vnx_enum_availability

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import not_none [as 别名]
def test_vnx_enum_availability(self):
        spa = storops.VNXSPEnum.SP_A
        assert_that(spa, not_none()) 
开发者ID:emc-openstack,项目名称:storops,代码行数:5,代码来源:__init__.py

示例14: test_unity_enum_availability

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import not_none [as 别名]
def test_unity_enum_availability(self):
        raid5 = storops.RaidTypeEnum.RAID5
        assert_that(raid5, not_none()) 
开发者ID:emc-openstack,项目名称:storops,代码行数:5,代码来源:__init__.py

示例15: test_parse_multi_index

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import not_none [as 别名]
def test_parse_multi_index(self):
        output = """
        A: a0
        B: b0
        C: c0

        A: a0
        B: b0
        D: d0

        A: a0
        B: b1
        C: c1
        """
        parsed = DemoParserMultiIndices().parse_all(output)
        assert_that(len(parsed), equal_to(2))
        a0b0 = next(i for i in parsed if i.b == 'b0')
        assert_that(a0b0, not_none())
        assert_that(a0b0.a, equal_to('a0'))
        assert_that(a0b0.b, equal_to('b0'))
        assert_that(a0b0.c, equal_to('c0'))
        assert_that(a0b0.d, equal_to('d0'))

        a0b1 = next(i for i in parsed if i.b == 'b1')
        assert_that(a0b1, not_none())
        assert_that(a0b1.a, equal_to('a0'))
        assert_that(a0b1.b, equal_to('b1'))
        assert_that(a0b1.c, equal_to('c1')) 
开发者ID:emc-openstack,项目名称:storops,代码行数:30,代码来源:test_parsers.py


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