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

Python tools.assert_in函数代码示例

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

本文整理汇总了Python中nose.tools.assert_in函数的典型用法代码示例。如果您正苦于以下问题:Python assert_in函数的具体用法?Python assert_in怎么用?Python assert_in使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: find_student_profile_table

def find_student_profile_table(step):  # pylint: disable=unused-argument
    # Find the grading configuration display
    world.wait_for_visible('#data-student-profiles-table')

    # Wait for the data table to be populated
    world.wait_for(lambda _: world.css_text('#data-student-profiles-table') not in [u'', u'Loading'])

    if world.role == 'instructor':
        expected_data = [
            world.instructor.username,
            world.instructor.email,
            world.instructor.profile.name,
            world.instructor.profile.gender,
            world.instructor.profile.goals
        ]
    elif world.role == 'staff':
        expected_data = [
            world.staff.username,
            world.staff.email,
            world.staff.profile.name,
            world.staff.profile.gender,
            world.staff.profile.goals
        ]
    for datum in expected_data:
        assert_in(datum, world.css_text('#data-student-profiles-table'))
开发者ID:Certific-NET,项目名称:edx-platform,代码行数:25,代码来源:data_download.py


示例2: test_mail_user

    def test_mail_user(self):

        user = factories.User()
        user_obj = model.User.by_name(user['name'])

        msgs = self.get_smtp_messages()
        assert_equal(msgs, [])

        # send email
        test_email = {'recipient': user_obj,
                      'subject': 'Meeting',
                      'body': 'The meeting is cancelled.',
                      'headers': {'header1': 'value1'}}
        mailer.mail_user(**test_email)

        # check it went to the mock smtp server
        msgs = self.get_smtp_messages()
        assert_equal(len(msgs), 1)
        msg = msgs[0]
        assert_equal(msg[1], config['smtp.mail_from'])
        assert_equal(msg[2], [user['email']])
        assert test_email['headers'].keys()[0] in msg[3], msg[3]
        assert test_email['headers'].values()[0] in msg[3], msg[3]
        assert test_email['subject'] in msg[3], msg[3]
        expected_body = self.mime_encode(test_email['body'],
                                         user['name'])

        assert_in(expected_body, msg[3])
开发者ID:MrkGrgsn,项目名称:ckan,代码行数:28,代码来源:test_mailer.py


示例3: test_iso19139_failure

    def test_iso19139_failure(self):
        errors = self.get_validation_errors(validation.ISO19139Schema,
                                            'iso19139/dataset-invalid.xml')

        assert len(errors) > 0
        assert_in('Dataset schema (gmx.xsd)', errors)
        assert_in('{http://www.isotc211.org/2005/gmd}nosuchelement\': This element is not expected.', errors)
开发者ID:datagovuk,项目名称:ckanext-spatial,代码行数:7,代码来源:test_validation.py


示例4: test_RegularizeCustomParam

 def test_RegularizeCustomParam(self):
     nn = MLPR(layers=[L("Tanh", units=8), L("Linear",)],
               weight_decay=0.01,
               n_iter=1)
     assert_equal(nn.weight_decay, 0.01)
     self._run(nn)
     assert_in('Using `L2` for regularization.', self.output.getvalue())
开发者ID:CheriPai,项目名称:scikit-neuralnetwork,代码行数:7,代码来源:test_rules.py


示例5: test_DropoutPerLayer

 def test_DropoutPerLayer(self):
     nn = MLPR(layers=[L("Rectifier", units=8, dropout=0.25), L("Linear")],
               regularize='dropout',
               n_iter=1)
     assert_equal(nn.regularize, 'dropout')
     self._run(nn)
     assert_in('Using `dropout` for regularization.', self.output.getvalue())
开发者ID:CheriPai,项目名称:scikit-neuralnetwork,代码行数:7,代码来源:test_rules.py


示例6: see_a_single_step_component

def see_a_single_step_component(step):
    for step_hash in step.hashes:
        component = step_hash['Component']
        assert_in(component, ['Discussion', 'Video'])
        component_css = 'div.xmodule_{}Module'.format(component)
        assert_true(world.is_css_present(component_css),
                    "{} couldn't be found".format(component))
开发者ID:xiandiancloud,项目名称:edx-platform,代码行数:7,代码来源:component.py


示例7: test_RegularizeExplicitL1

 def test_RegularizeExplicitL1(self):
     nn = MLPR(layers=[L("Tanh", units=8), L("Linear",)],
               regularize='L1',
               n_iter=1)
     assert_equal(nn.regularize, 'L1')
     self._run(nn)
     assert_in('Using `L1` for regularization.', self.output.getvalue())
开发者ID:CheriPai,项目名称:scikit-neuralnetwork,代码行数:7,代码来源:test_rules.py


示例8: test_super_repr

def test_super_repr():
    output = pretty.pretty(super(SA))
    nt.assert_in("SA", output)

    sb = SB()
    output = pretty.pretty(super(SA, sb))
    nt.assert_in("SA", output)
开发者ID:ngoldbaum,项目名称:ipython,代码行数:7,代码来源:test_pretty.py


示例9: _assert_breadcrumbs

    def _assert_breadcrumbs(self, document, lot):
        # check links exist back to
        # (1) digital marketplace,
        # (2) cloud tech and support,
        # (3) search page for lot

        # Hardcoded stuff found in 'views.py'
        breadcrumbs_expected = {
            '/': 'Digital Marketplace',
            '/g-cloud': 'Cloud technology and support',
            '/g-cloud/search?lot={}'.format(lot.lower()): self.lots[lot]
        }

        breadcrumbs = document.xpath('//div[@id="global-breadcrumb"]//a')
        assert_equal(3, len(breadcrumbs))

        for breadcrumb in breadcrumbs:
            breadcrumb_text = breadcrumb.text_content().strip()
            breakcrumb_href = breadcrumb.get('href').strip()
            # check that the link exists in our expected breadcrumbs
            assert_in(
                breakcrumb_href, breadcrumbs_expected
            )
            # check that the link text is the same
            assert_equal(
                breadcrumb_text, breadcrumbs_expected[breakcrumb_href]
            )
开发者ID:pebblecode,项目名称:cirrus-buyer-frontend,代码行数:27,代码来源:test_services.py


示例10: test_json_reports

 def test_json_reports(self):
     """Test that json_reports.js works"""
     if 'CASPERJS_EXECUTABLE' in os.environ:
         casperjs_executable = os.environ['CASPERJS_EXECUTABLE']
     else:
         casperjs_executable = 'casperjs'
     try:
         process = Popen(
             [
                 casperjs_executable,
                 'test', '--json', '--test-self',
                 os.path.join(
                     os.path.dirname(__file__),
                     '../../casper_tests/json_report.js'
                 )
             ],
             stdout=PIPE,
             stderr=PIPE
         )
     except OSError as e:
         return
     stdout_data, stderr_data = process.communicate()
     assert_in(
         '#JSON{"successes":["test json_report.js: a success"],"failures":["test json_report.js: a failure"]}',
         stdout_data.split("\n")
     )
开发者ID:NaturalHistoryMuseum,项目名称:dataportal_test_runner,代码行数:26,代码来源:test_json_reports.py


示例11: test_get_courses_for_wiki

    def test_get_courses_for_wiki(self):
        """
        Test the get_courses_for_wiki method
        """
        for course_number in self.courses:
            course_locations = self.draft_store.get_courses_for_wiki(course_number)
            assert_equals(len(course_locations), 1)
            assert_equals(Location('edX', course_number, '2012_Fall', 'course', '2012_Fall'), course_locations[0])

        course_locations = self.draft_store.get_courses_for_wiki('no_such_wiki')
        assert_equals(len(course_locations), 0)

        # set toy course to share the wiki with simple course
        toy_course = self.draft_store.get_course(SlashSeparatedCourseKey('edX', 'toy', '2012_Fall'))
        toy_course.wiki_slug = 'simple'
        self.draft_store.update_item(toy_course)

        # now toy_course should not be retrievable with old wiki_slug
        course_locations = self.draft_store.get_courses_for_wiki('toy')
        assert_equals(len(course_locations), 0)

        # but there should be two courses with wiki_slug 'simple'
        course_locations = self.draft_store.get_courses_for_wiki('simple')
        assert_equals(len(course_locations), 2)
        for course_number in ['toy', 'simple']:
            assert_in(Location('edX', course_number, '2012_Fall', 'course', '2012_Fall'), course_locations)

        # configure simple course to use unique wiki_slug.
        simple_course = self.draft_store.get_course(SlashSeparatedCourseKey('edX', 'simple', '2012_Fall'))
        simple_course.wiki_slug = 'edX.simple.2012_Fall'
        self.draft_store.update_item(simple_course)
        # it should be retrievable with its new wiki_slug
        course_locations = self.draft_store.get_courses_for_wiki('edX.simple.2012_Fall')
        assert_equals(len(course_locations), 1)
        assert_in(Location('edX', 'simple', '2012_Fall', 'course', '2012_Fall'), course_locations)
开发者ID:UXE,项目名称:edx-platform,代码行数:35,代码来源:test_mongo.py


示例12: test_get_context_data

 def test_get_context_data(self):
     self.view.draft = self.dr1
     res = self.view.get_context_data()
     nt.assert_is_instance(res, dict)
     nt.assert_in('draft', res)
     nt.assert_is_instance(res['draft'], dict)
     nt.assert_in('IMMEDIATE', res)
开发者ID:erinspace,项目名称:osf.io,代码行数:7,代码来源:test_views.py


示例13: test_rows

def test_rows():
    row_keys = ['rows-row1', 'rows-row2', 'rows-row3']
    data_old = {'cf1:col1': 'v1old', 'cf1:col2': 'v2old'}
    data_new = {'cf1:col1': 'v1new', 'cf1:col2': 'v2new'}

    with assert_raises(TypeError):
        table.rows(row_keys, object())

    with assert_raises(TypeError):
        table.rows(row_keys, timestamp='invalid')

    for row_key in row_keys:
        table.put(row_key, data_old, timestamp=4000)

    for row_key in row_keys:
        table.put(row_key, data_new)

    assert_dict_equal({}, table.rows([]))

    rows = dict(table.rows(row_keys))
    for row_key in row_keys:
        assert_in(row_key, rows)
        assert_dict_equal(data_new, rows[row_key])

    rows = dict(table.rows(row_keys, timestamp=5000))
    for row_key in row_keys:
        assert_in(row_key, rows)
        assert_dict_equal(data_old, rows[row_key])
开发者ID:abeusher,项目名称:happybase,代码行数:28,代码来源:test_api.py


示例14: test_families

def test_families():
    families = table.families()
    for name, fdesc in families.iteritems():
        assert_is_instance(name, basestring)
        assert_is_instance(fdesc, dict)
        assert_in('name', fdesc)
        assert_in('max_versions', fdesc)
开发者ID:abeusher,项目名称:happybase,代码行数:7,代码来源:test_api.py


示例15: test_testprofile_group_manager_no_name_args_gt_one

def test_testprofile_group_manager_no_name_args_gt_one():
    """profile.TestProfile.group_manager: no name and len(args) > 1 is valid"""
    prof = profile.TestProfile()
    with prof.group_manager(utils.Test, 'foo') as g:
        g(['a', 'b'])

    nt.assert_in(grouptools.join('foo', 'a b'), prof.test_list)
开发者ID:matt-auld,项目名称:piglit,代码行数:7,代码来源:profile_tests.py


示例16: _assert_document_links

    def _assert_document_links(self, document):

        service = self.service['services']

        # Hardcoded stuff comes from 'get_documents' in service_presenters.py
        url_keys = [
            'pricingDocumentURL',
            'sfiaRateDocumentURL',
            'serviceDefinitionDocumentURL',
            'termsAndConditionsDocumentURL'
        ]

        doc_hrefs = [a.get('href') for a in document.xpath(
            '//div[@id="meta"]//li[@class="document-list-item"]/a')]

        for url_key in url_keys:
            if url_key in self.service['services']:
                assert_in(
                    # Replace all runs of whitespace with a '%20'
                    self._replace_whitespace(service[url_key], '%20'),
                    doc_hrefs
                )

        if 'additionalDocumentURLs' in service:
            for document_url in service['additionalDocumentURLs']:
                assert_in(
                    self._replace_whitespace(document_url, '%20'),
                    doc_hrefs
                )
开发者ID:pebblecode,项目名称:cirrus-buyer-frontend,代码行数:29,代码来源:test_services.py


示例17: test_testprofile_group_manager_is_added

def test_testprofile_group_manager_is_added():
    """profile.TestProfile.group_manager: Tests are added to the profile"""
    prof = profile.TestProfile()
    with prof.group_manager(utils.Test, 'foo') as g:
        g(['a', 'b'], 'a')

    nt.assert_in(grouptools.join('foo', 'a'), prof.test_list)
开发者ID:matt-auld,项目名称:piglit,代码行数:7,代码来源:profile_tests.py


示例18: test_numpy_reset_array_undec

def test_numpy_reset_array_undec():
    "Test '%reset array' functionality"
    _ip.ex('import numpy as np')
    _ip.ex('a = np.empty(2)')
    nt.assert_in('a', _ip.user_ns)
    _ip.magic('reset -f array')
    nt.assert_not_in('a', _ip.user_ns)
开发者ID:jakevdp,项目名称:ipython,代码行数:7,代码来源:test_magic.py


示例19: see_a_multi_step_component

def see_a_multi_step_component(step, category):

    # Wait for all components to finish rendering
    selector = 'li.studio-xblock-wrapper div.xblock-student_view'
    world.wait_for(lambda _: len(world.css_find(selector)) == len(step.hashes))

    for idx, step_hash in enumerate(step.hashes):

        if category == 'HTML':
            html_matcher = {
                'Text':
                    '\n    \n',
                'Announcement':
                    '<p> Words of encouragement! This is a short note that most students will read. </p>',
                'Zooming Image':
                    '<h2>ZOOMING DIAGRAMS</h2>',
                'E-text Written in LaTeX':
                    '<h2>Example: E-text page</h2>',
                'Raw HTML':
                    '<p>This template is similar to the Text template. The only difference is',
            }
            actual_html = world.css_html(selector, index=idx)
            assert_in(html_matcher[step_hash['Component']], actual_html)
        else:
            actual_text = world.css_text(selector, index=idx)
            assert_in(step_hash['Component'].upper(), actual_text)
开发者ID:xiandiancloud,项目名称:edx-platform,代码行数:26,代码来源:component.py


示例20: test_edit_issue

    def test_edit_issue(self):
        # goto issue show page
        env = {'REMOTE_USER': self.owner['name'].encode('ascii')}
        response = self.app.get(
            url=toolkit.url_for('issues_show',
                                dataset_id=self.dataset['id'],
                                issue_number=self.issue['number']),
            extra_environ=env,
        )
        # click the edit link
        response = response.click(linkid='issue-edit-link', extra_environ=env)
        # fill in the form
        form = response.forms['issue-edit']
        form['title'] = 'edited title'
        form['description'] = 'edited description'
        # save the form
        response = helpers.webtest_submit(form, 'save', extra_environ=env)
        response = response.follow()
        # make sure it all worked
        assert_in('edited title', response)
        assert_in('edited description', response)

        result = helpers.call_action('issue_show',
                                     dataset_id=self.dataset['id'],
                                     issue_number=self.issue['number'])
        assert_equals(u'edited title', result['title'])
        assert_equals(u'edited description', result['description'])
开发者ID:SaintRamzes,项目名称:ckanext-issues,代码行数:27,代码来源:test_edit.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python tools.assert_is函数代码示例发布时间:2022-05-27
下一篇:
Python tools.assert_greater_equal函数代码示例发布时间: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