本文整理汇总了Python中nose.tools.assert_dict_contains_subset函数的典型用法代码示例。如果您正苦于以下问题:Python assert_dict_contains_subset函数的具体用法?Python assert_dict_contains_subset怎么用?Python assert_dict_contains_subset使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了assert_dict_contains_subset函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_createColumns
def test_createColumns():
columns_to_create = [Column(name="FirstTestColumn", columnType="INTEGER"), Column(name="SecondTestColumn",
columnType="DOUBLE")]
created_columns = syn.createColumns(columns_to_create)
assert_equals(len(columns_to_create), len(created_columns))
for col_to_create, created_col in zip(columns_to_create, created_columns):
assert_in('id', created_col)
assert_dict_contains_subset(col_to_create, created_col)
示例2: test_set_evar
def test_set_evar():
test_evars = {'ekey': 'evalue'}
for k, v in test_evars.items():
lpa.set_evar(k, v)
lpa_evars = lpa.get_cfg('evars')
assert_dict_contains_subset(test_evars, lpa_evars)
示例3: test_creates_user_no_email
def test_creates_user_no_email(self):
user = create_user(self.ec_dict)
assert_dict_contains_subset({
'id': u'e350cb61-ed72-4335-b915-7617b5e931f0',
'name': u'741c5e3e-53d0-431e-9f10-b6ebd39590f4',
'email': u'noemail',
},
user
)
示例4: test_get_all_evars
def test_get_all_evars():
test_evars = {'ekey1': 'evalue1', 'ekey2': 'evalue2'}
for k, v in test_evars.items():
lpa.set_evar(k, v)
lpa_evars = lpa.get_evar()
assert_dict_contains_subset(test_evars, lpa_evars)
示例5: test_basic_put
def test_basic_put(self):
"A basic put should work."
r1 = requests.put(self.url, self.simple_params)
n.assert_equal(r1.status_code, 204)
n.assert_equal(r1.content, '')
r2 = requests.get(self.url)
n.assert_equal(r2.status_code, 200)
n.assert_dict_contains_subset(self.http_params, json.loads(r2.text))
示例6: test_dict
def test_dict(test_controller):
"""verify that __iter__() (used by dict()) works"""
test_controller.duty = .1
assert_dict_contains_subset(
{
'interval': 1,
'duty': .1,
},
dict(test_controller)
)
示例7: test_request_response
def test_request_response(self):
mock_users_url = 'http://localhost:{port}/users'.format(port=self.mock_server_port)
# Patch USERS_URL so that the service uses the mock server URL instead of the real URL.
with patch.dict('example.services.__dict__', {'USERS_URL': mock_users_url}):
response = get_users()
assert_dict_contains_subset({'Content-Type': 'application/json; charset=utf-8'}, response.headers)
assert_true(response.ok)
assert_list_equal(response.json(), [])
示例8: test_creates_users
def test_creates_users(self):
user = create_user(self.ec_dict)
assert_dict_contains_subset({
'id': u'dcfb1b12-fe52-4d71-9aad-c60fc4c6952c',
'name': u'johndoe',
'fullname': u'John Doe',
'about': u'Description',
'email': u'[email protected]',
},
user
)
示例9: test_recording
def test_recording(self):
recorder = MongodbEnvironLagRecorder(
self.collection, 'PATH', 'REMOTE_USER')
environ = {'PATH': '/', 'REMOTE_USER': 'jsmith'}
recorder(2.5, environ)
eq_(1, self.collection.count())
mongo_document = self.collection.find_one()
assert_dict_contains_subset(environ, mongo_document)
示例10: simpledec
def simpledec(decorator=None, f=None, *args, **kwargs):
sd_dec = sd.simple_decorator(decorator)
decorated_f = sd_dec(f)
nt.assert_dict_contains_subset(
meta_comp(f),
meta_comp(decorated_f),
msg = "decorated function failed. function: %s - %r decorator: %s - %r" % (
f.__name__, meta_comp(f),decorator.__name__,meta_comp(decorated_f)))
nt.assert_dict_contains_subset(
meta_comp(decorator),
meta_comp(sd_dec),
msg = "simple_decorator on decorator fn %s failed" % decorator.__name__)
示例11: response_content_element_has
def response_content_element_has(step, element, identifier):
from lettuce.django.steps.models import hashes_data
element_data = world.response.data[element]
element_data_by_id = {data.get(identifier): dict(data) for data in element_data}
# Transform tabular data.
step_data_by_id = {data.get(identifier): data for data in hashes_data(step)}
assert_equal(len(element_data_by_id), len(step_data_by_id))
for identifier, data in step_data_by_id.items():
assert_dict_contains_subset(actual=element_data_by_id[identifier], expected=data)
示例12: _assert_credentials_set_in_request
def _assert_credentials_set_in_request(key_class, expected_key_name):
authentication_key_value = get_uuid4_str()
authentication_key = key_class(authentication_key_value)
connection = \
_MockPortalConnection(authentication_key=authentication_key)
connection.send_get_request(_STUB_URL_PATH)
expected_credentials = {expected_key_name: [authentication_key_value]}
prepared_request = connection.prepared_requests[0]
query_string_args = \
_get_query_string_args_from_url(prepared_request.url)
assert_dict_contains_subset(expected_credentials, query_string_args)
示例13: test_dashboard_new
def test_dashboard_new(self):
dashboard1 = self.new_basic_dashboard()["dashboard"]
assert_dict_contains_subset(self.basic_dashboard, dashboard1)
# test dashboard created successful
rv = self.app.get("/api/dashboard/{}".format(dashboard1["id"]))
assert_equal(rv.status_code, 200)
dashboard2 = _load_json(rv)["dashboard"]
assert_equal(dashboard1, dashboard2)
# test the new created dashboard in dashboards list
dashboards = _load_json(self.app.get("/api/dashboards"))["dashboards"]
assert_in(dashboard1, dashboards)
示例14: test_glider_information
def test_glider_information():
assert_dict_contains_subset(
dict(model='', reg='', cid=''),
read_igc_headers(['AFLA6NG', 'HFDTE',
'HFGTYGLIDERTYPE:',
'HFGIDGLIDERID:',
'HFCIDCOMPETITIONID:']))
assert_dict_contains_subset(
dict(model='HORNET', reg='D_4449', cid='TH'),
read_igc_headers(['AFLA6NG', 'HFDTE150812',
'HFGTYGLIDERTYPE:HORNET',
'HFGIDGLIDERID:D_4449',
'HFCIDCOMPETITIONID:TH']))
示例15: test_change_source
def test_change_source(self):
change_source = get_uuid4_str()
connection = _MockPortalConnection(change_source=change_source)
connection.send_get_request(_STUB_URL_PATH)
prepared_request = connection.prepared_requests[0]
query_string_args = \
_get_query_string_args_from_url(prepared_request.url)
expected_change_source_args = {'auditId': [change_source]}
assert_dict_contains_subset(
expected_change_source_args,
query_string_args,
)