本文整理汇总了Python中hamcrest.is_not方法的典型用法代码示例。如果您正苦于以下问题:Python hamcrest.is_not方法的具体用法?Python hamcrest.is_not怎么用?Python hamcrest.is_not使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hamcrest
的用法示例。
在下文中一共展示了hamcrest.is_not方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_creating_deleting_a_bond
# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import is_not [as 别名]
def test_creating_deleting_a_bond(self):
self.client.add_bond(3)
list_of_bonds = self.client.get_bonds()
assert_that(list_of_bonds, has_item(has_properties(number=3)))
bond = self.client.get_bond(3)
assert_that(bond, has_properties(number=3))
self.client.remove_bond(3)
new_list_of_bonds = self.client.get_bonds()
assert_that(new_list_of_bonds, is_not(has_item(has_properties(number=3))))
with self.assertRaises(UnknownBond):
self.client.get_bond(3)
示例2: test_add_and_get_and_delete_dhcp_relay_server
# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import is_not [as 别名]
def test_add_and_get_and_delete_dhcp_relay_server(self):
try:
self.client.add_vlan(2999, name="my-test-vlan")
self.client.add_dhcp_relay_server(2999, ip_address=IPAddress("10.10.10.1"))
vlan = self.get_vlan_from_list(2999)
dhcp_relay_server = next((g for g in vlan.dhcp_relay_servers if str(g) == '10.10.10.1'), None)
assert_that(dhcp_relay_server, is_not(None))
self.client.remove_dhcp_relay_server(2999, ip_address=IPAddress("10.10.10.1"))
vlan = self.get_vlan_from_list(2999)
dhcp_relay_server = next((g for g in vlan.dhcp_relay_servers if str(g) == '10.10.10.1'), None)
assert_that(dhcp_relay_server, is_(none()))
finally:
self.client.remove_vlan(2999)
示例3: test_show_run_vs_show_run_interface_same_output
# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import is_not [as 别名]
def test_show_run_vs_show_run_interface_same_output(self, t):
enable(t)
configuring_interface(t, "ethernet 1/g1", do="shutdown")
assert_interface_configuration(t, "ethernet 1/g1", [
"shutdown"
])
assert_running_config_contains_in_order(t, [
"interface ethernet 1/g1",
"shutdown",
"exit",
"!",
])
configuring_interface(t, "ethernet 1/g1", do="no shutdown")
assert_interface_configuration(t, "ethernet 1/g1", [
""
])
config = get_running_config(t)
assert_that(config, is_not(has_item("interface ethernet 1/g1")))
示例4: test_show_run_vs_show_run_interface_same_output
# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import is_not [as 别名]
def test_show_run_vs_show_run_interface_same_output(self, t):
enable(t)
configuring_interface(t, "tengigabitethernet 0/0/1", do="shutdown")
assert_interface_configuration(t, "tengigabitethernet 0/0/1", [
"shutdown"
])
assert_running_config_contains_in_order(t, [
"interface tengigabitethernet 0/0/1",
"shutdown",
"exit",
"!",
])
configuring_interface(t, "tengigabitethernet 0/0/1", do="no shutdown")
assert_interface_configuration(t, "tengigabitethernet 0/0/1", [
""
])
config = get_running_config(t)
assert_that(config, is_not(has_item("interface tengigabitethernet 0/0/1")))
示例5: test__shouldNotInjectToAdminOfTheModelThatDoesNotHaveStateFieldInIt
# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import is_not [as 别名]
def test__shouldNotInjectToAdminOfTheModelThatDoesNotHaveStateFieldInIt(self):
assert_that(admin.site._registry[Function].inlines, is_not(has_item(OnApprovedHookInline)))
assert_that(admin.site._registry[Function].inlines, is_not(has_item(OnTransitHookInline)))
assert_that(admin.site._registry[Function].inlines, is_not(has_item(OnCompleteHookInline)))
示例6: step_impl
# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import is_not [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']))
示例7: validate_etag
# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import is_not [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))
示例8: validate_refresh_token
# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import is_not [as 别名]
def validate_refresh_token(context):
response = context.refresh_token_response
assert_that(response.status_code, equal_to(HTTPStatus.OK))
new_login = json.loads(response.data)
assert_that(new_login, has_key(equal_to('uuid')))
assert_that(new_login, has_key(equal_to('accessToken')))
assert_that(new_login, has_key(equal_to('refreshToken')))
assert_that(new_login, has_key(equal_to('expiration')))
old_login = json.loads(context.activate_device_response.data)
assert_that(new_login['uuid']), equal_to(old_login['uuid'])
assert_that(new_login['accessToken'], is_not(equal_to(old_login['accessToken'])))
assert_that(new_login['refreshToken'], is_not(equal_to(old_login['refreshToken'])))
示例9: validate_new_etag
# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import is_not [as 别名]
def validate_new_etag(context):
etag = context.device_etag
response = context.get_setting_invalid_etag_response
etag_from_response = response.headers.get('ETag')
assert_that(etag, is_not(etag_from_response))
示例10: validate_new_etag
# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import is_not [as 别名]
def validate_new_etag(context):
etag = context.device_etag
response = context.response_using_invalid_etag
etag_from_response = response.headers.get('ETag')
assert_that(etag, is_not(etag_from_response))
示例11: test_save_overwrite
# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import is_not [as 别名]
def test_save_overwrite(self, config_file_path):
config = FileConfig(config_file_path=config_file_path)
assert_that(config_file_path, is_not(equal_to('newtoken')))
config.auth_token = 'newtoken'
config.save()
config_reloaded = FileConfig(config_file_path=config_file_path)
assert_that(config_reloaded.auth_token, equal_to('newtoken'))
示例12: test_add_and_get_group
# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import is_not [as 别名]
def test_add_and_get_group(self):
try:
self.client.add_vlan(2999, name="my-test-vlan")
self.client.add_ip_to_vlan(2999, IPNetwork("10.10.0.3/27"))
self.client.add_vrrp_group(
vlan_number=2999,
group_id=73,
ips=[IPAddress("10.10.0.1"), IPAddress("10.10.0.2")],
priority=110,
track_id=self.test_vrrp_track_id,
track_decrement=50,
hello_interval=5,
dead_interval=15
)
vlan = self.get_vlan_from_list(2999)
vrrp_group = next((g for g in vlan.vrrp_groups if g.id == 73), None)
assert_that(vrrp_group, is_not(None))
assert_that([str(ip) for ip in vrrp_group.ips], is_(["10.10.0.1", "10.10.0.2"]))
assert_that(vrrp_group.priority, is_(110))
assert_that(vrrp_group.track_id, is_(self.test_vrrp_track_id))
assert_that(vrrp_group.track_decrement, is_(50))
assert_that(vrrp_group.hello_interval, is_(5))
assert_that(vrrp_group.dead_interval, is_(15))
self.client.remove_vrrp_group(vlan_number=2999, group_id=73)
vlan = self.get_vlan_from_list(2999)
vrrp_group = next((g for g in vlan.vrrp_groups if g.id == 73), None)
assert_that(vrrp_group, is_(none()))
finally:
self.client.remove_vlan(2999)
示例13: test_two_get_connections_on_different_switches_should_give_different_semaphores
# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import is_not [as 别名]
def test_two_get_connections_on_different_switches_should_give_different_semaphores(self):
self.semaphore_mocks['hostname1'] = mock.Mock()
self.semaphore_mocks['hostname2'] = mock.Mock()
switch1 = self.factory.get_anonymous_switch(hostname='hostname1', model='test_model')
switch2 = self.factory.get_anonymous_switch(hostname='hostname2', model='test_model')
assert_that(switch1.lock, is_not(switch2.lock))
示例14: test_add_smp_to_ioclass
# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import is_not [as 别名]
def test_add_smp_to_ioclass(self):
ioclass = VNXIOClass(name='with_luns_snaps', cli=t_cli())
smp1 = VNXLun(name='m2', cli=t_cli())
new_class = ioclass.add_lun(smp1)
assert_that(new_class, instance_of(VNXIOClass))
assert_that(new_class, is_not(ioclass))
示例15: test_get_folder_from_url
# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import is_not [as 别名]
def test_get_folder_from_url(self):
url = '/api/types/metric?compact=true&fields=name,type'
folder = MockRestClient.get_folder_from_url(url)
assert_that(folder, is_not(contains_string('api')))
assert_that(folder, is_not(contains_string('types')))
assert_that(folder, contains_string('metric'))