• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python tools.assert_dict_contains_subset函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: test_subfield_mapper

def test_subfield_mapper():
    mapper = get_mapper()
    tm = mapper()

    tm.foo['bar']['baz'].set('fumm')
    tm.save()

    res = mapper.collection.find_one()
    expected = {'foo': {'bar': {'baz': 'fumm'}}}
    assert_dict_contains_subset(expected, res)

    tm.foo['bar']['baz'].set('fnorb')
    tm.save()

    res = mapper.collection.find_one()
    expected = {'foo': {'bar': {'baz': 'fnorb'}}}
    assert_dict_contains_subset(expected, res)

    tm.foo['bar'].set({'baz': 'ding'})
    tm.save()

    res = mapper.collection.find_one()
    expected = {'foo': {'bar': {'baz': 'ding'}}}
    assert_dict_contains_subset(expected, res)

    tm.foo.set({'bar': {'baz': 'yadda'}})
    tm.save()

    res = mapper.collection.find_one()
    expected = {'foo': {'bar': {'baz': 'yadda'}}}
    assert_dict_contains_subset(expected, res)
开发者ID:dwwoelfel,项目名称:dibble,代码行数:31,代码来源:test_subfields.py


示例17: test_user_create

    def test_user_create(self, mock_request):
        content = {"UserName": 'testuser',
            "About": "about",
            "DisplayName": "display name",
            "Roles": ['OrganisationEditor'],
            "FirstName": "firstname",
            "LastName": "lastname",
            "UserId": "userid123",
            "IsRegistered": False,
            "OrganisationId": 'organisation123',
            "Email": "[email protected]"
        }
        mock_request.return_value = mock.Mock(
            status_code=200,
            content=json.dumps(content),
            **{
                'raise_for_status.return_value': None,
                'json.return_value': content,
            }
        )
        site_user = helpers.call_action('get_site_user')
        handle_user_update(
            context={
                'model': model,
                'ignore_auth': True,
                'local_action': True,
                'user': site_user['name']
            },
            audit={'CustomProperties':{'UserName':'testuser'}},
            harvest_object=None,
        )

        user = helpers.call_action('user_show', id='testuser')
        membership = helpers.call_action('member_list', id='organisation123')
        nt.assert_dict_contains_subset(
            {'about': u'about',
             'display_name': u'display name',
             'email_hash': '6dc2fde946483a1d8a84b89345a1b638',
             'fullname': u'display name',
             'id': u'userid123',
             'name': u'testuser',
             'state': u'active',
             'sysadmin': False
            },
            user
        )
        nt.assert_equals(membership[1], (u'userid123', u'user', u'Editor'))

        membership = helpers.call_action('member_list', id='an_org')
        nt.assert_false(u'userid123' in set(i[0] for i in membership))
开发者ID:Nithyavasudevan,项目名称:ckanext-glasgow,代码行数:50,代码来源:test_harvest.py


示例18: test_modelmapper_unsafe_update

def test_modelmapper_unsafe_update():
    db = get_db()
    mapper = dibble.mapper.ModelMapper(ReloadTestModel, db.reloadtest)

    m = mapper()
    m.foo.set('bar')
    m.counter.set(1)
    m.save()

    m._update.inc('counter', 41)
    m.save()

    expected = {'foo': 'bar', 'counter': 42}
    assert_dict_contains_subset(expected, dict(m))
开发者ID:dwwoelfel,项目名称:dibble,代码行数:14,代码来源:test_mapper.py


示例19: test_chart_new

    def test_chart_new(self):
        chart1 = self.new_basic_chart()["chart"]
        assert_dict_contains_subset(self.basic_chart, chart1)

        # test chart created successful
        rv = self.app.get("/api/chart/{}".format(chart1["id"]))
        assert_equal(rv.status_code, 200)

        chart2 = _load_json(rv)["chart"]
        assert_equal(chart1, chart2)

        # test the new created chart in charts list
        charts = _load_json(self.app.get("/api/charts"))["charts"]
        assert_in(chart1, charts)
开发者ID:ritksm,项目名称:polaris,代码行数:14,代码来源:test_chart.py


示例20: test_perform_request_called_correctly_for_get_method

    def test_perform_request_called_correctly_for_get_method(self,
                                                             mock_request):
        url = 'https://rundeck.example.com/api/13/test_endpoint'
        mock_request.return_value = self.resp

        self.client._perform_request(url)
        args = mock_request.call_args
        nt.assert_equal(2, len(args))
        nt.assert_equal(('GET', url,), args[0])
        nt.assert_in('headers', args[1])
        headers = args[1]['headers']
        nt.assert_dict_contains_subset({'X-Rundeck-Auth-Token': self.token,
                                        'User-Agent':
                                        'PyRundeck v ' + __version__},
                                       headers)
开发者ID:EKT,项目名称:pyrundeck,代码行数:15,代码来源:core_test.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python tools.assert_dict_equal函数代码示例发布时间:2022-05-27
下一篇:
Python tools.assert_almost_equals函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap