當前位置: 首頁>>代碼示例>>Python>>正文


Python hamcrest.instance_of方法代碼示例

本文整理匯總了Python中hamcrest.instance_of方法的典型用法代碼示例。如果您正苦於以下問題:Python hamcrest.instance_of方法的具體用法?Python hamcrest.instance_of怎麽用?Python hamcrest.instance_of使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在hamcrest的用法示例。


在下文中一共展示了hamcrest.instance_of方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_get_single

# 需要導入模塊: import hamcrest [as 別名]
# 或者: from hamcrest import instance_of [as 別名]
def test_get_single(self):
        mg = VNXMirrorGroup.get(t_cli(), name='petermg')
        assert_that(mg, instance_of(VNXMirrorGroup))
        assert_that(mg.name, equal_to('petermg'))
        assert_that(mg.gid, equal_to('50:06:01:60:B6:60:25:22:00:00:00:00'))
        assert_that(mg.description, equal_to(''))
        assert_that(mg.state, equal_to('Synchronized'))
        assert_that(mg.role, equal_to('Primary'))
        assert_that(mg.condition, equal_to('Active'))
        assert_that(mg.policy, equal_to(VNXMirrorGroupRecoveryPolicy.MANUAL))
        assert_that(mg.mirrors, has_length(2))
        assert_that(mg.group_mirrors, has_length(2))
        for m in mg.mirrors:
            assert_that(m, instance_of(VNXMirrorView))

        for mg in mg.group_mirrors:
            assert_that(
                mg.mirror_name,
                not_none())
            assert_that(mg.src_lun_id, instance_of(int)) 
開發者ID:emc-openstack,項目名稱:storops,代碼行數:22,代碼來源:test_mirror_view.py

示例2: test_get_properties

# 需要導入模塊: import hamcrest [as 別名]
# 或者: from hamcrest import instance_of [as 別名]
def test_get_properties(self):
        fi = UnityFileInterface('if_16', cli=t_rest())
        assert_that(fi.existed, equal_to(True))
        assert_that(fi.nas_server, instance_of(UnityNasServer))
        assert_that(fi.ip_port, instance_of(UnityIpPort))
        assert_that(fi.health, instance_of(UnityHealth))
        assert_that(fi.ip_address, equal_to('10.244.220.120'))
        assert_that(fi.ip_protocol_version,
                    equal_to(IpProtocolVersionEnum.IPv4))
        assert_that(fi.netmask, equal_to('255.255.255.0'))
        assert_that(fi.gateway, equal_to('10.244.220.1'))
        assert_that(fi.mac_address, equal_to('00:60:16:5C:08:E1'))
        assert_that(fi.name, equal_to('8_FNM00151200215'))
        assert_that(fi.role, equal_to(FileInterfaceRoleEnum.PRODUCTION))
        assert_that(fi.is_preferred, equal_to(True))
        assert_that(fi.is_disabled, equal_to(False)) 
開發者ID:emc-openstack,項目名稱:storops,代碼行數:18,代碼來源:test_interface.py

示例3: test_properties

# 需要導入模塊: import hamcrest [as 別名]
# 或者: from hamcrest import instance_of [as 別名]
def test_properties(self):
        snap = UnitySnap(_id=171798691852, cli=t_rest())
        assert_that(snap.existed, equal_to(True))
        assert_that(snap.state, equal_to(SnapStateEnum.READY))
        assert_that(snap.name, equal_to('esa_nfs1_2016-03-15_10:56:29'))
        assert_that(snap.is_system_snap, equal_to(False))
        assert_that(snap.is_modifiable, equal_to(False))
        assert_that(snap.is_read_only, equal_to(False))
        assert_that(snap.is_modified, equal_to(False))
        assert_that(snap.is_auto_delete, equal_to(True))
        assert_that(snap.size, equal_to(5368709120))
        assert_that(str(snap.creation_time),
                    equal_to('2016-03-15 02:57:27.092000+00:00'))
        assert_that(snap.storage_resource, instance_of(UnityStorageResource))
        assert_that(snap.creator_type,
                    equal_to(SnapCreatorTypeEnum.USER_CUSTOM))
        assert_that(snap.access_type,
                    equal_to(FilesystemSnapAccessTypeEnum.CHECKPOINT))
        assert_that(snap.is_cg_snap(), equal_to(False)) 
開發者ID:emc-openstack,項目名稱:storops,代碼行數:21,代碼來源:test_snap.py

示例4: test_get_properties

# 需要導入模塊: import hamcrest [as 別名]
# 或者: from hamcrest import instance_of [as 別名]
def test_get_properties(self):
        ri = replication_interface.UnityReplicationInterface.get(
            cli=mock.t_rest(), _id='if_10')
        hc.assert_that(ri.gateway, hc.equal_to('10.245.47.1'))
        hc.assert_that(ri.health, hc.instance_of(health.UnityHealth))
        hc.assert_that(ri.health.value, hc.equal_to(storops.HealthEnum.OK))
        hc.assert_that(ri.id, hc.equal_to('if_10'))
        hc.assert_that(ri.ip_address, hc.equal_to('10.245.47.99'))
        hc.assert_that(ri.ip_port, hc.instance_of(port.UnityIpPort))
        hc.assert_that(ri.ip_port.id, hc.equal_to('spa_eth2'))
        hc.assert_that(ri.ip_protocol_version,
                       hc.equal_to(storops.IpProtocolVersionEnum.IPv4))
        hc.assert_that(ri.mac_address, hc.equal_to('00:60:16:5C:07:0B'))
        hc.assert_that(ri.name, hc.equal_to('4_FNM00150600267'))
        hc.assert_that(ri.netmask, hc.equal_to('255.255.255.0'))
        hc.assert_that(ri.v6_prefix_length, hc.none())
        hc.assert_that(ri.vlan_id, hc.none()) 
開發者ID:emc-openstack,項目名稱:storops,代碼行數:19,代碼來源:test_replication_interface.py

示例5: test_get_properties

# 需要導入模塊: import hamcrest [as 別名]
# 或者: from hamcrest import instance_of [as 別名]
def test_get_properties(self):
        sr = UnityStorageResource(_id='res_27', cli=t_rest())
        assert_that(sr.id, equal_to('res_27'))
        assert_that(sr.type, equal_to(StorageResourceTypeEnum.FILE_SYSTEM))
        assert_that(sr.replication_type, equal_to(ReplicationTypeEnum.NONE))
        assert_that(sr.thin_status, equal_to(ThinStatusEnum.TRUE))
        assert_that(sr.relocation_policy,
                    equal_to(TieringPolicyEnum.AUTOTIER_HIGH))
        assert_that(sr.health, instance_of(UnityHealth))
        assert_that(sr.name, equal_to('fs3'))
        assert_that(sr.description, equal_to(''))
        assert_that(sr.is_replication_destination, equal_to(False))
        assert_that(sr.size_total, equal_to(3221225472))
        assert_that(sr.size_used, equal_to(1620303872))
        assert_that(sr.size_allocated, equal_to(3221225472))
        assert_that(sr.per_tier_size_used, equal_to([6442450944, 0, 0]))
        assert_that(sr.metadata_size, equal_to(3489660928))
        assert_that(sr.metadata_size_allocated, equal_to(3221225472))
        assert_that(sr.snaps_size_total, equal_to(0))
        assert_that(sr.snaps_size_allocated, equal_to(0))
        assert_that(sr.snap_count, equal_to(0))
        assert_that(sr.pools, instance_of(UnityPoolList))
        assert_that(sr.filesystem, instance_of(UnityFileSystem)) 
開發者ID:emc-openstack,項目名稱:storops,代碼行數:25,代碼來源:test_storage_resource.py

示例6: test_switch_model_exists

# 需要導入模塊: import hamcrest [as 別名]
# 或者: from hamcrest import instance_of [as 別名]
def test_switch_model_exists(self):
        core_mock = mock.create_autospec(switch_core.SwitchCore)
        core_mock.get_default_ports.return_value = mock.sentinel.port_list
        with mock.patch('fake_switches.switch_factory.switch_configuration') as switch_conf_module:
            switch_conf_instance = mock.Mock()
            switch_conf_class = mock.Mock()
            switch_conf_class.return_value = switch_conf_instance
            switch_conf_module.SwitchConfiguration = switch_conf_class
            factory = switch_factory.SwitchFactory(mapping={'a': core_mock})
            switch = factory.get('a', 'my_hostname')

        assert_that(switch, is_(instance_of(switch_core.SwitchCore)))
        switch_conf_class.assert_called_with('127.0.0.1',
                                             name='my_hostname',
                                             ports=mock.sentinel.port_list,
                                             privileged_passwords=['root'])
        core_mock.assert_called_with(switch_conf_instance) 
開發者ID:internap,項目名稱:fake-switches,代碼行數:19,代碼來源:test_switch_factory.py

示例7: test_shouldInjectTheField

# 需要導入模塊: import hamcrest [as 別名]
# 或者: from hamcrest import instance_of [as 別名]
def test_shouldInjectTheField(self):  # pylint: disable=no-self-use
        assert_that(BasicTestModel, has_property('river', is_(instance_of(RiverObject))))
        assert_that(BasicTestModel.river, has_property('my_field', is_(instance_of(ClassWorkflowObject))))

        content_type = ContentType.objects.get_for_model(BasicTestModel)

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

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

        transition_meta = TransitionMetaFactory.create(
            workflow=workflow,
            source_state=state1,
            destination_state=state2,
        )

        TransitionApprovalMetaFactory.create(
            workflow=workflow,
            transition_meta=transition_meta,
            priority=0
        )
        test_model = BasicTestModel.objects.create()
        assert_that(test_model, has_property('river', is_(instance_of(RiverObject))))
        assert_that(test_model.river, has_property('my_field', is_(instance_of(InstanceWorkflowObject))))
        assert_that(BasicTestModel.river.my_field, has_property('initial_state', is_(instance_of(State))))
        assert_that(BasicTestModel.river.my_field, has_property('final_states', is_(instance_of(QuerySet))))

        assert_that(test_model.river.my_field, has_property('approve', has_property("__call__")))
        assert_that(test_model.river.my_field, has_property('on_initial_state', is_(instance_of(bool))))
        assert_that(test_model.river.my_field, has_property('on_final_state', is_(instance_of(bool)))) 
開發者ID:javrasya,項目名稱:django-river,代碼行數:33,代碼來源:test__state_field.py

示例8: test__shouldInjectExistingAdminOfTheModelThatHasStateFieldInIt

# 需要導入模塊: import hamcrest [as 別名]
# 或者: from hamcrest import instance_of [as 別名]
def test__shouldInjectExistingAdminOfTheModelThatHasStateFieldInIt(self):
        assert_that(admin.site._registry[BasicTestModel], instance_of(BasicTestModelAdmin))
        assert_that(admin.site._registry[BasicTestModel].inlines, has_item(OnApprovedHookInline))
        assert_that(admin.site._registry[BasicTestModel].inlines, has_item(OnTransitHookInline))
        assert_that(admin.site._registry[BasicTestModel].inlines, has_item(OnCompleteHookInline)) 
開發者ID:javrasya,項目名稱:django-river,代碼行數:7,代碼來源:test__app.py

示例9: test__shouldInjectADefaultAdminWithTheHooks

# 需要導入模塊: import hamcrest [as 別名]
# 或者: from hamcrest import instance_of [as 別名]
def test__shouldInjectADefaultAdminWithTheHooks(self):
        assert_that(admin.site._registry[BasicTestModelWithoutAdmin], instance_of(DefaultWorkflowModelAdmin))
        assert_that(admin.site._registry[BasicTestModel].inlines, has_item(OnApprovedHookInline))
        assert_that(admin.site._registry[BasicTestModel].inlines, has_item(OnTransitHookInline))
        assert_that(admin.site._registry[BasicTestModel].inlines, has_item(OnCompleteHookInline)) 
開發者ID:javrasya,項目名稱:django-river,代碼行數:7,代碼來源:test__app.py

示例10: step_impl

# 需要導入模塊: import hamcrest [as 別名]
# 或者: from hamcrest import instance_of [as 別名]
def step_impl(context):
    if context.result['account'][0] == 'S':
        cancel_items = (
            ('market_id', 'S'),
            ('bs', context.result['ord_bs']),
            ('branch', context.result['account'][1:5]),  # [S9A95   0483976]
            ('account', context.result['account'][8:15]),
            ('code_id', context.result['code_id']),
            ('ord_type', context.result['ord_type']),
            ('ord_seq', context.result['ord_seq']),
            ('ord_no', context.result['ord_no']),
            ('pre_order', ' ' if context.result['ord_no'] == '00000' else 'N'))
        cancel_order = OrderedDict(cancel_items)
    elif context.result['account'][0] == 'F':
        cancel_items = (
            ('market_id', 'F'),
            ('branch', context.result['account'][1:8]),  # [FF0020009114728]
            ('account', context.result['account'][8:15]),
            ('code_id', context.result['code_id'].strip()),
            ('ord_seq', context.result['ord_seq']),
            ('ord_no', context.result['ord_no']),
            ('oct_type', context.result['oct_type']),
            ('pre_order', ' ' if context.result['ord_no'] == '00000' else 'N'))
        cancel_order = OrderedDict(cancel_items)
    orders = context.api.placing_cancel_order(cancel_order)
    assert_that(orders, is_not(instance_of(str)), '回傳型態錯誤,錯誤訊息[{}]'.format(orders))
    assert_that(context.result['code_id'], equal_to(orders['code_id'])) 
開發者ID:ypochien,項目名稱:Sinopac-Order-API,代碼行數:29,代碼來源:test_order_api.py

示例11: test_factory

# 需要導入模塊: import hamcrest [as 別名]
# 或者: from hamcrest import instance_of [as 別名]
def test_factory():
    switch = RealSwitchFactory().get_switch_by_descriptor(
                SwitchDescriptor(hostname='hostname', model='juniper_mx', username='username', password='password', port=22)
            )

    assert_that(switch, instance_of(Juniper))
    assert_that(switch.switch_descriptor.hostname, equal_to("hostname"))
    assert_that(switch.switch_descriptor.model, equal_to("juniper_mx"))
    assert_that(switch.switch_descriptor.username, equal_to("username"))
    assert_that(switch.switch_descriptor.password, equal_to("password"))
    assert_that(switch.switch_descriptor.port, equal_to(22)) 
開發者ID:internap,項目名稱:netman,代碼行數:13,代碼來源:juniper_mx_test.py

示例12: test_factory_ssh

# 需要導入模塊: import hamcrest [as 別名]
# 或者: from hamcrest import instance_of [as 別名]
def test_factory_ssh():
    lock = Mock()
    switch = brocade_factory_ssh(SwitchDescriptor(hostname='hostname', model='brocade', username='username', password='password', port=22), lock)

    assert_that(switch, instance_of(FlowControlSwitch))
    assert_that(switch.wrapped_switch, instance_of(Brocade))
    assert_that(switch.lock, is_(lock))
    assert_that(switch.switch_descriptor.hostname, equal_to("hostname"))
    assert_that(switch.switch_descriptor.model, equal_to("brocade"))
    assert_that(switch.switch_descriptor.username, equal_to("username"))
    assert_that(switch.switch_descriptor.password, equal_to("password"))
    assert_that(switch.switch_descriptor.port, equal_to(22)) 
開發者ID:internap,項目名稱:netman,代碼行數:14,代碼來源:brocade_backward_compatibility_test.py

示例13: test_factory_telnet

# 需要導入模塊: import hamcrest [as 別名]
# 或者: from hamcrest import instance_of [as 別名]
def test_factory_telnet():
    lock = Mock()
    switch = brocade_factory_telnet(SwitchDescriptor(hostname='hostname', model='brocade', username='username', password='password', port=23), lock)

    assert_that(switch, instance_of(FlowControlSwitch))
    assert_that(switch.wrapped_switch, instance_of(Brocade))
    assert_that(switch.lock, is_(lock))
    assert_that(switch.switch_descriptor.hostname, equal_to("hostname"))
    assert_that(switch.switch_descriptor.model, equal_to("brocade"))
    assert_that(switch.switch_descriptor.username, equal_to("username"))
    assert_that(switch.switch_descriptor.password, equal_to("password"))
    assert_that(switch.switch_descriptor.port, equal_to(23)) 
開發者ID:internap,項目名稱:netman,代碼行數:14,代碼來源:brocade_backward_compatibility_test.py

示例14: test_factory

# 需要導入模塊: import hamcrest [as 別名]
# 或者: from hamcrest import instance_of [as 別名]
def test_factory():
    lock = mock.Mock()
    switch = juniper.qfx_copper_factory(SwitchDescriptor(hostname='hostname', model='juniper_qfx_copper', username='username', password='password', port=22), lock)

    assert_that(switch, instance_of(FlowControlSwitch))
    assert_that(switch.wrapped_switch, instance_of(Juniper))
    assert_that(switch.lock, is_(lock))
    assert_that(switch.switch_descriptor.hostname, equal_to("hostname"))
    assert_that(switch.switch_descriptor.model, equal_to("juniper_qfx_copper"))
    assert_that(switch.switch_descriptor.username, equal_to("username"))
    assert_that(switch.switch_descriptor.password, equal_to("password"))
    assert_that(switch.switch_descriptor.port, equal_to(22)) 
開發者ID:internap,項目名稱:netman,代碼行數:14,代碼來源:juniper_qfx_copper_test.py

示例15: test_factory

# 需要導入模塊: import hamcrest [as 別名]
# 或者: from hamcrest import instance_of [as 別名]
def test_factory():
    switch = factory(SwitchDescriptor(hostname='hostname', model='juniper', username='username', password='password', port=22))

    assert_that(switch, instance_of(RemoteSwitch))
    assert_that(switch.switch_descriptor.hostname, equal_to("hostname"))
    assert_that(switch.switch_descriptor.model, equal_to("juniper"))
    assert_that(switch.switch_descriptor.username, equal_to("username"))
    assert_that(switch.switch_descriptor.password, equal_to("password"))
    assert_that(switch.switch_descriptor.port, equal_to(22)) 
開發者ID:internap,項目名稱:netman,代碼行數:11,代碼來源:remote_test.py


注:本文中的hamcrest.instance_of方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。