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


Python hamcrest.none方法代码示例

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


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

示例1: test__shouldHandleUndefinedSecondWorkflowCase

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import none [as 别名]
def test__shouldHandleUndefinedSecondWorkflowCase(self):
        state1 = StateObjectFactory(label="state1")
        state2 = StateObjectFactory(label="state2")

        content_type = ContentType.objects.get_for_model(ModelWithTwoStateFields)
        workflow = WorkflowFactory(initial_state=state1, content_type=content_type, field_name="status1")

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

        workflow_object = ModelWithTwoStateFieldsObjectFactory()

        assert_that(workflow_object.model.status1, equal_to(state1))
        assert_that(workflow_object.model.status2, none()) 
开发者ID:javrasya,项目名称:django-river,代码行数:24,代码来源:test__instance_api.py

示例2: validate_response

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import none [as 别名]
def validate_response(context):
    response_data = context.response.json
    account = context.accounts['foo']
    assert_that(
        response_data['emailAddress'],
        equal_to(account.email_address)
    )
    assert_that(
        response_data['membership']['type'],
        equal_to('Monthly Membership')
    )
    assert_that(response_data['membership']['duration'], none())
    assert_that(
        response_data['membership'], has_item('id')
    )

    assert_that(len(response_data['agreements']), equal_to(3))
    agreement = response_data['agreements'][0]
    assert_that(agreement['type'], equal_to(PRIVACY_POLICY))
    assert_that(
        agreement['acceptDate'],
        equal_to(str(date.today().strftime('%B %d, %Y')))
    )
    assert_that(agreement, has_item('id')) 
开发者ID:MycroftAI,项目名称:selene-backend,代码行数:26,代码来源:profile.py

示例3: test_get_vlan_with_an_empty_interface

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import none [as 别名]
def test_get_vlan_with_an_empty_interface(self):
        self.shell_mock.should_receive("do").with_args("show vlan 1750").once().ordered().and_return(
            vlan_with_vif_display(1750, 999, name="Shizzle")
        )

        self.shell_mock.should_receive("do").with_args("show running-config interface ve 999").once().ordered().and_return([
            "interface ve 999",
            "!",
        ])

        vlan = self.switch.get_vlan(1750)

        assert_that(vlan.number, is_(1750))
        assert_that(vlan.name, is_("Shizzle"))
        assert_that(vlan.access_groups[IN], is_(none()))
        assert_that(vlan.access_groups[OUT], is_(none()))
        assert_that(vlan.vrf_forwarding, is_(none()))
        assert_that(vlan.ips, is_(empty()))
        assert_that(vlan.vrrp_groups, is_(empty()))
        assert_that(vlan.dhcp_relay_servers, is_(empty())) 
开发者ID:internap,项目名称:netman,代码行数:22,代码来源:brocade_test.py

示例4: test_get_vlan_with_an_empty_interface

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import none [as 别名]
def test_get_vlan_with_an_empty_interface(self):
        self.mocked_ssh_client.should_receive("do").with_args("show running-config vlan 1750 | begin vlan").and_return([
            "vlan 1750",
            " name Shizzle",
            "end"
        ])

        self.mocked_ssh_client.should_receive("do").with_args("show running-config interface vlan 1750 | begin interface").once().ordered().and_return([
            "interface Vlan1750",
            " no ip address"
            "end"
        ])

        vlan = self.switch.get_vlan(1750)

        assert_that(vlan.number, is_(1750))
        assert_that(vlan.name, is_("Shizzle"))
        assert_that(vlan.access_groups[IN], is_(none()))
        assert_that(vlan.access_groups[OUT], is_(none()))
        assert_that(vlan.vrf_forwarding, is_(none()))
        assert_that(vlan.ips, is_(empty()))
        assert_that(vlan.vrrp_groups, is_(empty()))
        assert_that(vlan.dhcp_relay_servers, is_(empty()))
        assert_that(vlan.unicast_rpf_mode, is_(None))
        assert_that(vlan.arp_routing, is_(True)) 
开发者ID:internap,项目名称:netman,代码行数:27,代码来源:cisco_test.py

示例5: parse_range_test

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import none [as 别名]
def parse_range_test(self):

        result = parse_vlan_ranges(None)
        assert_that(list(result), equal_to(range(1, 4094)))

        result = parse_vlan_ranges("none")
        assert_that(list(result), equal_to([]))

        result = parse_vlan_ranges("1")
        assert_that(list(result), equal_to([1]))

        result = parse_vlan_ranges("2-5")
        assert_that(list(result), equal_to([2, 3, 4, 5]))

        result = parse_vlan_ranges("1,3-5,7")
        assert_that(list(result), equal_to([1, 3, 4, 5, 7])) 
开发者ID:internap,项目名称:netman,代码行数:18,代码来源:cisco_test.py

示例6: test_set_trunk_mode_initial

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import none [as 别名]
def test_set_trunk_mode_initial(self):
        self.mocked_ssh_client.should_receive("do").with_args("show running-config interface FastEthernet0/4").once().ordered().and_return([
            "Building configuration...",
            "Current configuration : 156 bytes",
            "!",
            "interface FastEthernet0/4",
            "end"
        ])
        self.mocked_ssh_client.should_receive("do").with_args("configure terminal").once().ordered().and_return([
            "Enter configuration commands, one per line.  End with CNTL/Z."
        ])
        self.mocked_ssh_client.should_receive("do").with_args("interface FastEthernet0/4").and_return([]).once().ordered()
        self.mocked_ssh_client.should_receive("do").with_args("switchport mode trunk").and_return([]).once().ordered()
        self.mocked_ssh_client.should_receive("do").with_args("switchport trunk allowed vlan none").and_return([]).once().ordered()
        self.mocked_ssh_client.should_receive("do").with_args("no switchport access vlan").and_return([]).once().ordered()
        self.mocked_ssh_client.should_receive("do").with_args("exit").and_return([]).twice().ordered().ordered()

        self.switch.set_trunk_mode("FastEthernet0/4") 
开发者ID:internap,项目名称:netman,代码行数:20,代码来源:cisco_test.py

示例7: test_set_trunk_mode_switching_mode

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import none [as 别名]
def test_set_trunk_mode_switching_mode(self):
        self.mocked_ssh_client.should_receive("do").with_args("show running-config interface FastEthernet0/4").once().ordered().and_return([
            "Building configuration...",
            "Current configuration : 156 bytes",
            "!",
            "interface FastEthernet0/4",
            " switchport mode access",
            "end"
        ])
        self.mocked_ssh_client.should_receive("do").with_args("configure terminal").once().ordered().and_return([
            "Enter configuration commands, one per line.  End with CNTL/Z."
        ])
        self.mocked_ssh_client.should_receive("do").with_args("interface FastEthernet0/4").and_return([]).once().ordered()
        self.mocked_ssh_client.should_receive("do").with_args("switchport mode trunk").and_return([]).once().ordered()
        self.mocked_ssh_client.should_receive("do").with_args("switchport trunk allowed vlan none").and_return([]).once().ordered()
        self.mocked_ssh_client.should_receive("do").with_args("no switchport access vlan").and_return([]).once().ordered()
        self.mocked_ssh_client.should_receive("do").with_args("exit").and_return([]).twice().ordered().ordered()

        self.switch.set_trunk_mode("FastEthernet0/4") 
开发者ID:internap,项目名称:netman,代码行数:21,代码来源:cisco_test.py

示例8: test_set_trunk_mode_idempotent

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import none [as 别名]
def test_set_trunk_mode_idempotent(self):
        self.mocked_ssh_client.should_receive("do").with_args("show running-config interface FastEthernet0/4").once().ordered().and_return([
            "Building configuration...",
            "Current configuration : 156 bytes",
            "!",
            "interface FastEthernet0/4",
            " switchport trunk allowed vlan 2999",
            " switchport mode trunk",
            "end"
        ])
        self.mocked_ssh_client.should_receive("do").with_args("switchport trunk allowed vlan none").never()
        self.mocked_ssh_client.should_receive("do").with_args("configure terminal").once().ordered().and_return([
            "Enter configuration commands, one per line.  End with CNTL/Z."
        ])
        self.mocked_ssh_client.should_receive("do").with_args("interface FastEthernet0/4").and_return([]).once().ordered()
        self.mocked_ssh_client.should_receive("do").with_args("switchport mode trunk").and_return([]).once().ordered()
        self.mocked_ssh_client.should_receive("do").with_args("no switchport access vlan").and_return([]).once().ordered()
        self.mocked_ssh_client.should_receive("do").with_args("exit").and_return([]).twice().ordered().ordered()

        self.switch.set_trunk_mode("FastEthernet0/4") 
开发者ID:internap,项目名称:netman,代码行数:22,代码来源:cisco_test.py

示例9: test_set_bond_trunk_mode_switching_mode

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import none [as 别名]
def test_set_bond_trunk_mode_switching_mode(self):
        self.mocked_ssh_client.should_receive("do").with_args("show running-config interface Port-channel4").once().ordered().and_return([
            "Building configuration...",
            "Current configuration : 156 bytes",
            "!",
            "interface Port-channel4",
            " switchport mode access",
            "end"
        ])
        self.mocked_ssh_client.should_receive("do").with_args("configure terminal").once().ordered().and_return([
            "Enter configuration commands, one per line.  End with CNTL/Z."
        ])
        self.mocked_ssh_client.should_receive("do").with_args("interface Port-channel4").and_return([]).once().ordered()
        self.mocked_ssh_client.should_receive("do").with_args("switchport mode trunk").and_return([]).once().ordered()
        self.mocked_ssh_client.should_receive("do").with_args("switchport trunk allowed vlan none").and_return([]).once().ordered()
        self.mocked_ssh_client.should_receive("do").with_args("no switchport access vlan").and_return([]).once().ordered()
        self.mocked_ssh_client.should_receive("do").with_args("exit").and_return([]).twice().ordered().ordered()

        self.switch.set_bond_trunk_mode(4) 
开发者ID:internap,项目名称:netman,代码行数:21,代码来源:cisco_test.py

示例10: test_set_bond_trunk_mode_idempotent

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import none [as 别名]
def test_set_bond_trunk_mode_idempotent(self):
        self.mocked_ssh_client.should_receive("do").with_args("show running-config interface Port-channel4").once().ordered().and_return([
            "Building configuration...",
            "Current configuration : 156 bytes",
            "!",
            "interface Port-channel4",
            " switchport trunk allowed vlan 2999",
            " switchport mode trunk",
            "end"
        ])
        self.mocked_ssh_client.should_receive("do").with_args("switchport trunk allowed vlan none").never()
        self.mocked_ssh_client.should_receive("do").with_args("configure terminal").once().ordered().and_return([
            "Enter configuration commands, one per line.  End with CNTL/Z."
        ])
        self.mocked_ssh_client.should_receive("do").with_args("interface Port-channel4").and_return([]).once().ordered()
        self.mocked_ssh_client.should_receive("do").with_args("switchport mode trunk").and_return([]).once().ordered()
        self.mocked_ssh_client.should_receive("do").with_args("no switchport access vlan").and_return([]).once().ordered()
        self.mocked_ssh_client.should_receive("do").with_args("exit").and_return([]).twice().ordered().ordered()

        self.switch.set_bond_trunk_mode(4) 
开发者ID:internap,项目名称:netman,代码行数:22,代码来源:cisco_test.py

示例11: verify_lun_0

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import none [as 别名]
def verify_lun_0(lun):
    assert_that(lun.lun_id, equal_to(0))
    assert_that(lun.name, equal_to('File_CS0_21132_0_d7'))
    assert_that(lun.state, equal_to('Ready'))
    assert_that(lun.current_owner, equal_to(VNXSPEnum.SP_A))
    assert_that(lun.default_owner, equal_to(VNXSPEnum.SP_A))
    assert_that(lun.wwn, equal_to(
        '60:06:01:60:12:60:3D:00:95:63:38:87:9D:69:E5:11'))
    assert_that(lun.operation, equal_to('None'))
    assert_that(lun.pool_name, equal_to('Pool4File'))
    assert_that(lun.is_thin_lun, equal_to(False))
    assert_that(lun.is_compressed, equal_to(False))
    assert_that(lun.is_dedup, equal_to(False))
    assert_that(lun.is_private, equal_to(False))
    assert_that(lun.tier, equal_to(VNXTieringEnum.HIGH_AUTO))
    assert_that(lun.provision, equal_to(VNXProvisionEnum.THICK))
    assert_that(lun.user_capacity_gbs, equal_to(500.0))
    assert_that(lun.consumed_capacity_gbs, equal_to(512.249))
    assert_that(lun.existed, equal_to(True))
    assert_that(lun.primary_lun, none())
    assert_that(lun.is_snap_mount_point, equal_to(False)) 
开发者ID:emc-openstack,项目名称:storops,代码行数:23,代码来源:verifiers.py

示例12: verify_raid0

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import none [as 别名]
def verify_raid0(rg):
    assert_that(rg.raid_group_id, equal_to(0))
    assert_that(rg.raid_group_type, equal_to(VNXRaidType.RAID5))
    assert_that(rg.state, equal_to('Valid_luns'))
    assert_that(rg.disks.index,
                has_items('0_0_A0', '0_0_A1', '0_0_A2', '0_0_A3', '0_0_A4'))
    assert_that(rg.list_of_luns, has_item(63868))
    assert_that(len(rg.list_of_luns), equal_to(16))
    assert_that(rg.max_number_of_disks, equal_to(16))
    assert_that(rg.max_number_of_luns, equal_to(256))
    assert_that(rg.raw_capacity_blocks, equal_to(4502487040))
    assert_that(rg.logical_capacity_blocks, equal_to(4502478848))
    assert_that(rg.free_capacity_blocks_non_contiguous,
                equal_to(3744083968))
    assert_that(rg.free_contiguous_group_of_unbound_segments,
                equal_to(1749913216))
    assert_that(rg.defrag_expand_priority, equal_to('N/A'))
    assert_that(rg.percent_defragmented, none())
    assert_that(rg.percent_expanded, none())
    assert_that(rg.disk_expanding_onto, equal_to('N/A'))
    assert_that(rg.lun_expansion_enabled, equal_to(False))
    assert_that(rg.legal_raid_types[0], equal_to(VNXRaidType.RAID5)) 
开发者ID:emc-openstack,项目名称:storops,代码行数:24,代码来源:verifiers.py

示例13: test_parse

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import none [as 别名]
def test_parse(self):
        output = """
                ID: test
                Prop A (Name): ab (c)
                Prop B: d ef
                """
        parser = DemoParser()
        parsed = parser.parse(output, [A, ID, C])

        assert_that(parsed.prop_a, equal_to('ab (c)'))
        assert_that(parsed.prop_c, none())
        assert_that(parsed.id, equal_to('test'))

        def f():
            log.debug(parsed.prop_b)

        assert_that(f, raises(AttributeError)) 
开发者ID:emc-openstack,项目名称:storops,代码行数:19,代码来源:test_parsers.py

示例14: test_get_properties

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

示例15: test_get_properties

# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import none [as 别名]
def test_get_properties(self):
        rs = remote_system.UnityRemoteSystem.get(cli=mock.t_rest(), _id='RS_0')
        hc.assert_that(rs.alt_management_address_list, hc.none())
        hc.assert_that(rs.connection_type,
                       hc.equal_to(storops.ReplicationCapabilityEnum.ASYNC))
        hc.assert_that(rs.health, hc.instance_of(health.UnityHealth))
        hc.assert_that(rs.health.value, hc.equal_to(storops.HealthEnum.OK))
        hc.assert_that(rs.id, hc.equal_to('RS_0'))
        hc.assert_that(rs.local_spa_interfaces,
                       hc.equal_to(['128.221.255.12']))
        hc.assert_that(rs.local_spb_interfaces,
                       hc.equal_to(['128.221.255.13']))
        hc.assert_that(rs.management_address, hc.equal_to('10.245.101.39'))
        hc.assert_that(rs.model, hc.equal_to('Unity 500'))
        hc.assert_that(rs.name, hc.equal_to('FNM00150600267'))
        hc.assert_that(rs.remote_spa_interfaces,
                       hc.equal_to(['128.221.255.12']))
        hc.assert_that(rs.remote_spb_interfaces,
                       hc.equal_to(['128.221.255.13']))
        hc.assert_that(rs.serial_number, hc.equal_to('FNM00150600267'))
        hc.assert_that(rs.sync_fc_ports, hc.equal_to(['spa_fc4', 'spb_fc4']))
        hc.assert_that(rs.username, hc.equal_to('admin')) 
开发者ID:emc-openstack,项目名称:storops,代码行数:24,代码来源:test_remote_system.py


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