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


Python tools.assert_dict_contains_subset函数代码示例

本文整理汇总了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)
开发者ID:Sage-Bionetworks,项目名称:synapsePythonClient,代码行数:8,代码来源:test_REST_request_helpers.py

示例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)
开发者ID:CentOS-PaaS-SIG,项目名称:linch-pin,代码行数:9,代码来源:tests_init_pass.py

示例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
     )
开发者ID:Nithyavasudevan,项目名称:ckanext-glasgow-1,代码行数:9,代码来源:test_get_users.py

示例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)
开发者ID:CentOS-PaaS-SIG,项目名称:linch-pin,代码行数:9,代码来源:tests_init_pass.py

示例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))
开发者ID:tlevine,项目名称:redirect.thomaslevine.com,代码行数:9,代码来源:integrationtests.py

示例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)
    )
开发者ID:wtucker,项目名称:pi-pwm,代码行数:10,代码来源:test_controllers.py

示例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(), [])
开发者ID:ParentJA,项目名称:example-mock-server-python,代码行数:10,代码来源:test_mock_server.py

示例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
     )
开发者ID:Nithyavasudevan,项目名称:ckanext-glasgow-1,代码行数:11,代码来源:test_get_users.py

示例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)
开发者ID:2degrees,项目名称:wsgi-lag,代码行数:11,代码来源:test_mongodb_recorder.py

示例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__)
开发者ID:KWMalik,项目名称:simpleutils,代码行数:12,代码来源:test_simpledecorators.py

示例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)
开发者ID:ParentJA,项目名称:safefamilies,代码行数:13,代码来源:terrain.py

示例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)
开发者ID:brightinteractive,项目名称:hubspot-connection,代码行数:13,代码来源:test_connection.py

示例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)
开发者ID:ritksm,项目名称:polaris,代码行数:14,代码来源:test_dashboard.py

示例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']))
开发者ID:imclab,项目名称:skylines,代码行数:14,代码来源:test_igc.py

示例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,
            )
开发者ID:brightinteractive,项目名称:hubspot-connection,代码行数:14,代码来源:test_connection.py


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