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

Python testing.assert_equal函数代码示例

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

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



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

示例1: assert_request_buttons

 def assert_request_buttons(self, tree, button_classes, button_text):
     found_buttons = []
     for button in tree.iter('button'):
         T.assert_in(button.attrib['class'], button_classes)
         T.assert_in(button.text, button_text)
         found_buttons.append(button)
     T.assert_equal(len(button_classes), len(found_buttons))
开发者ID:imbstack,项目名称:pushmanager,代码行数:7,代码来源:test_template_request.py


示例2: test_get_api_page

 def test_get_api_page(self):
     T.MockedSettings['api_app'] = {'port': 8043, 'servername': 'push.test.com'}
     with mock.patch.dict(Settings, T.MockedSettings):
         T.assert_equal(
             RequestHandler.get_api_page("pushes"),
             "http://push.test.com:8043/api/pushes"
         )
开发者ID:baris,项目名称:pushmanager,代码行数:7,代码来源:test_core_requesthandler.py


示例3: assert_checklist_for_tags

    def assert_checklist_for_tags(self, tags, requestid=None):
        num_checks = 0
        checks = []

        # Gather reference checklists from the code
        for tag in tags:
            # While the tag name is 'search-backend', the checklist type
            # is truncated to 'search'.
            if tag == 'search-backend':
                tag = 'search'

            if tag not in checklist_reminders:
                continue

            plain_list = checklist_reminders[tag]
            num_checks += len(plain_list)
            checks += [(tag, check) for check in plain_list]

            cleanup_tag = '%s-cleanup' % tag
            cleanup_list = checklist_reminders[cleanup_tag]
            num_checks += len(cleanup_list)
            checks += [(cleanup_tag, check) for check in cleanup_list]

        reqid = self.make_request_with_tags(tags, requestid)
        checklists = self.get_checklists(reqid)

        T.assert_equal(num_checks, len(checklists))
        for check in checks:
            T.assert_in((reqid, check[0], check[1]), checklists)

        return reqid
开发者ID:bchess,项目名称:pushmanager,代码行数:31,代码来源:test_servlet_newrequest.py


示例4: test_process_queue_duplicate

    def test_process_queue_duplicate(self):
        with nested(
            mock.patch("%s.core.git.GitQueue.update_request_failure" % __name__),
            mock.patch("%s.core.git.GitQueue.update_request_successful" % __name__),
            # This will fail, stop logging errors
            mock.patch("%s.core.git.logging.error" % __name__),
            mock.patch(
                "%s.core.git.GitQueue._get_request_with_sha" % __name__,
                return_value = {'id': 10, 'state': 'requested'}
            ),
            self.mocked_update_request(self.fake_request, self.fake_request)
        ):
            # GitQueue._get_request_with_sha returning a value means
            # we have a duplicated request. This should trigger a
            # failure
            T.assert_equal(core.git.GitQueue.update_request_failure.call_count, 1)
            T.assert_equal(core.git.GitQueue.update_request_successful.call_count, 0)

            # Match the error message for duplicate revision. error_msg
            # should be the last item of the first call object's *args list
            # (from mock library).
            T.assert_in(
                "another request with the same revision sha",
                core.git.GitQueue.update_request_failure.call_args_list[0][0][-1]
            )
开发者ID:bchess,项目名称:pushmanager,代码行数:25,代码来源:test_core_git.py


示例5: test_checklist_duplicate

    def test_checklist_duplicate(self):
        with fake_checklist_request():
            # insert fake data from FakeDataMixin
            fake_pushid = 2
            self.insert_pushes()
            self.insert_requests()
            test1_request = self.get_requests_by_user('testuser1')[0]
            test2_request = self.get_requests_by_user('testuser2')[0]
            self.insert_pushcontent(test1_request['id'], fake_pushid)
            self.insert_pushcontent(test2_request['id'], fake_pushid)

            # insert fake checklist data
            checklist_queries = []
            for req in (test1_request, test2_request):
                checklist_queries.append(db.push_checklist.insert({
                    'request': req['id'],
                    'type': 'search',
                    'target': 'prod'
                }))
                checklist_queries.append(db.push_checklist.insert({
                    'request': req['id'],
                    'type': 'search-cleanup',
                    'target': 'post-verify-prod'
                }))
            db.execute_transaction_cb(checklist_queries, on_db_return)

            uri = "/checklist?id=%d" % fake_pushid
            response = self.fetch(uri)
            T.assert_equal(response.error, None)
            T.assert_not_in("No checklist items for this push", response.body)
            T.assert_not_equal(re.search("for testuser\d,testuser\d", response.body), None)
            T.assert_in("After Certifying - Do In Prod", response.body)
开发者ID:baris,项目名称:pushmanager,代码行数:32,代码来源:test_servlet_checklist.py


示例6: test_checklist_single_search_tag

    def test_checklist_single_search_tag(self):
        with fake_checklist_request():
            # insert fake data from FakeDataMixin
            fake_pushid = 2
            self.insert_pushes()
            self.insert_requests()
            test1_request = self.get_requests_by_user('testuser1')[0]
            self.insert_pushcontent(test1_request['id'], fake_pushid)

            # insert fake checklist data
            checklist_queries = [
                db.push_checklist.insert({
                    'request': test1_request['id'],
                    'type': 'search',
                    'target': 'prod'
                }),
                db.push_checklist.insert({
                    'request': test1_request['id'],
                    'type': 'search-cleanup',
                    'target': 'post-verify-prod'
                }),
            ]
            db.execute_transaction_cb(checklist_queries, on_db_return)

            uri = "/checklist?id=%d" % fake_pushid
            response = self.fetch(uri)
            T.assert_equal(response.error, None)
            T.assert_not_in("No checklist items for this push", response.body)
            T.assert_not_in("multiple requests", response.body)
            T.assert_in("for testuser1", response.body)
            T.assert_in("After Certifying - Do In Prod", response.body)
开发者ID:baris,项目名称:pushmanager,代码行数:31,代码来源:test_servlet_checklist.py


示例7: test_get_repository_uri_basic

 def test_get_repository_uri_basic(self):
     T.MockedSettings["git"] = self.fake_settings
     with mock.patch.dict(Settings, T.MockedSettings):
         T.assert_equal(core.git.GitQueue._get_repository_uri("main_repository"),
           "git://example/main_repository")
         T.assert_equal(core.git.GitQueue._get_repository_uri("second_repository"),
           "git://example/dev_directory/second_repository")
开发者ID:bchess,项目名称:pushmanager,代码行数:7,代码来源:test_core_git.py


示例8: test_hoods_checklists

    def test_hoods_checklists(self):
        with fake_checklist_request():
            # insert fake data from FakeDataMixin
            fake_pushid = 2
            self.insert_pushes()
            self.insert_requests()
            req = self.get_requests_by_user('testuser1')[0]
            self.insert_pushcontent(req['id'], fake_pushid)

            # insert fake checklist data
            checklist_queries = []
            checklist_items = (
                {'request': req['id'], 'type': 'hoods', 'target': 'stage'},
                {'request': req['id'], 'type': 'hoods', 'target': 'post-stage'},
                {'request': req['id'], 'type': 'hoods', 'target': 'prod'},
                {'request': req['id'], 'type': 'hoods-cleanup', 'target': 'post-verify-stage'},
            )
            for checklist_item in checklist_items:
                checklist_queries.append(db.push_checklist.insert(checklist_item))

            db.execute_transaction_cb(checklist_queries, on_db_return)

            uri = "/checklist?id=%d" % fake_pushid
            response = self.fetch(uri)
            T.assert_equal(response.error, None)
            T.assert_not_in("No checklist items for this push", response.body)
            T.assert_in("Notify testuser1 to deploy Geoservices to stage", response.body)
            T.assert_in("Notify testuser1 to deploy Geoservices to prod", response.body)
            T.assert_in("Ask Search to force index distribution on stage for testuser1", response.body)
开发者ID:baris,项目名称:pushmanager,代码行数:29,代码来源:test_servlet_checklist.py


示例9: test_removerequest

    def test_removerequest(self):
        results = []

        def on_db_return(success, db_results):
            assert success
            results.extend(db_results.fetchall())

        with nested(
            mock.patch.dict(db.Settings, T.MockedSettings),
            mock.patch.object(
                RemoveRequestServlet,
                "get_current_user",
                return_value="testuser"
            )
        ):
            results = []
            db.execute_cb(db.push_pushcontents.select(), on_db_return)
            num_results_before = len(results)

            uri = "/removerequest?request=1&push=1"
            response = self.fetch(uri)
            T.assert_equal(response.error, None)

            results = []
            db.execute_cb(db.push_pushcontents.select(), on_db_return)
            num_results_after = len(results)

            T.assert_equal(num_results_after, num_results_before - 1, "Request removal failed.")
开发者ID:bchess,项目名称:pushmanager,代码行数:28,代码来源:test_servlet_removerequest.py


示例10: test_update_request_failure

 def test_update_request_failure(self):
     with nested(
         mock.patch("%s.core.git.MailQueue.enqueue_user_email" % __name__),
         mock.patch("%s.core.git.webhook_req" % __name__),
         mock.patch("%s.core.git.logging.error" % __name__),
     ):
         core.git.GitQueue.update_request_failure(self.fake_request, "fake failure")
         T.assert_equal(core.git.MailQueue.enqueue_user_email.call_count, 1)
开发者ID:bchess,项目名称:pushmanager,代码行数:8,代码来源:test_core_git.py


示例11: test_get_repository_uri_with_auth

 def test_get_repository_uri_with_auth(self):
     T.MockedSettings["git"] = self.fake_settings
     T.MockedSettings["git"]["auth"] = "myuser:mypass"
     with mock.patch.dict(Settings, T.MockedSettings):
         T.assert_equal(core.git.GitQueue._get_repository_uri("main_repository"),
           "git://myuser:[email protected]/main_repository")
         T.assert_equal(core.git.GitQueue._get_repository_uri("second_repository"),
           "git://myuser:[email protected]/dev_directory/second_repository")
开发者ID:bchess,项目名称:pushmanager,代码行数:8,代码来源:test_core_git.py


示例12: test_update_request_successful

 def test_update_request_successful(self):
     with nested(
         mock.patch("%s.core.git.MailQueue.enqueue_user_email" % __name__),
         mock.patch("%s.core.git.webhook_req" % __name__)
     ):
         core.git.GitQueue.update_request_successful(self.fake_request)
         T.assert_equal(core.git.MailQueue.enqueue_user_email.call_count, 1)
         T.assert_equal(core.git.webhook_req.call_count, 3)
开发者ID:bchess,项目名称:pushmanager,代码行数:8,代码来源:test_core_git.py


示例13: test_escape

 def test_escape(self):
     T.assert_equal(
         [k for k in self.d if self.ed[k] != self.escaped[k]],
         [],
         "EscapedDict values doesn't match with pre-computed valued",
     )
     T.assert_in("&", self.ed["amp"])
     T.assert_not_in(">", self.ed["gt"])
开发者ID:baris,项目名称:pushmanager,代码行数:8,代码来源:test_core_util.py


示例14: test_create_request_bookmarklet

 def test_create_request_bookmarklet(self):
     with self.page(CreateRequestBookmarkletHandler) as response:
         # We'll get a javascript as the body, just check some
         # variable names/strings that we know is there in the
         # script.
         T.assert_equal(response.error, None)
         T.assert_in("ticketNumberToURL", response.body)
         T.assert_in("codeReview", response.body)
开发者ID:baris,项目名称:pushmanager,代码行数:8,代码来源:test_bookmarklet.py


示例15: test_pushplans_and_search

    def test_pushplans_and_search(self):
        tag = ['pushplans']
        orig_reqid = self.assert_checklist_for_tags(tag)

        tags = ['pushplans', 'search-backend']
        new_reqid = self.assert_checklist_for_tags(tags, orig_reqid)

        T.assert_equal(orig_reqid, new_reqid)
开发者ID:bchess,项目名称:pushmanager,代码行数:8,代码来源:test_servlet_newrequest.py


示例16: test_search_and_hoods

    def test_search_and_hoods(self):
        tag = ['hoods']
        orig_reqid = self.assert_checklist_for_tags(tag)

        tags = ['search-backend', 'hoods']
        new_reqid = self.assert_checklist_for_tags(tags, orig_reqid)

        T.assert_equal(orig_reqid, new_reqid)
开发者ID:bchess,项目名称:pushmanager,代码行数:8,代码来源:test_servlet_newrequest.py


示例17: test_pushplans_and_hoods

    def test_pushplans_and_hoods(self):
        tag = ['hoods']
        orig_reqid = self.assert_checklist_for_tags(tag)

        tags = ['pushplans', 'hoods']
        new_reqid = self.assert_checklist_for_tags(tags, orig_reqid)

        T.assert_equal(orig_reqid, new_reqid)
开发者ID:bchess,项目名称:pushmanager,代码行数:8,代码来源:test_servlet_newrequest.py


示例18: test_kill_processes

 def test_kill_processes(self):
     with contextlib.nested(
             self.mock_method('%s.pid.os.kill' % __name__, None, None),
             self.mock_method('%s.pid.is_process_alive' % __name__, False, None)
     ):
         # this should run fine, all processes are dead
         pids = [1, 2, 3, 4, 5]
         pid.kill_processes(pids)
         T.assert_equal(pids, [])
开发者ID:baris,项目名称:pushmanager,代码行数:9,代码来源:test_core_pid.py


示例19: test_include_new_push

    def test_include_new_push(self):
        tree = self.render_pushes_page()

        found_form = []
        for form in tree.iter('form'):
            if form.attrib['id'] == 'push-info-form':
                found_form.append(form)

        T.assert_equal(len(found_form), 1)
开发者ID:nvdnkpr,项目名称:pushmanager,代码行数:9,代码来源:test_template_pushes.py


示例20: test_include_request_info

    def test_include_request_info(self):
        tree = self.render_module_request_with_users(self.basic_request,'testuser', 'testuser', **self.basic_kwargs)

        found_ul = []
        for ul in tree.iter('ul'):
            if ul.attrib['class'] == 'request-info-inline':
                found_ul.append(ul)

        T.assert_equal(1, len(found_ul))
开发者ID:imbstack,项目名称:pushmanager,代码行数:9,代码来源:test_template_request.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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