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


Python six.assertRegex方法代码示例

本文整理汇总了Python中six.assertRegex方法的典型用法代码示例。如果您正苦于以下问题:Python six.assertRegex方法的具体用法?Python six.assertRegex怎么用?Python six.assertRegex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在six的用法示例。


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

示例1: test_default_oauth2_urls

# 需要导入模块: import six [as 别名]
# 或者: from six import assertRegex [as 别名]
def test_default_oauth2_urls(self):
        flow_obj = DropboxOAuth2Flow('dummy_app_key', 'dummy_app_secret',
            'http://localhost/dummy', 'dummy_session', 'dbx-auth-csrf-token')

        six.assertRegex(
            self,
            flow_obj._get_authorize_url('http://localhost/redirect', 'state', 'legacy'),
            r'^https://{}/oauth2/authorize\?'.format(re.escape(session.WEB_HOST)),
        )

        self.assertEqual(
            flow_obj.build_url('/oauth2/authorize'),
            'https://{}/oauth2/authorize'.format(session.API_HOST),
        )

        self.assertEqual(
            flow_obj.build_url('/oauth2/authorize', host=session.WEB_HOST),
            'https://{}/oauth2/authorize'.format(session.WEB_HOST),
        ) 
开发者ID:dropbox,项目名称:dropbox-sdk-python,代码行数:21,代码来源:test_dropbox.py

示例2: testSetup

# 需要导入模块: import six [as 别名]
# 或者: from six import assertRegex [as 别名]
def testSetup(self, _mock_TurbiniaClient):
    """Tests that the processor is set up correctly."""
    test_state = state.DFTimewolfState(config.Config)
    turbinia_processor = turbinia.TurbiniaProcessor(test_state)
    turbinia_processor.SetUp(
        disk_name='disk-1',
        project='turbinia-project',
        turbinia_zone='europe-west1',
        sketch_id=123,
        run_all_jobs=False)
    self.assertEqual(turbinia_processor.disk_name, 'disk-1')
    self.assertEqual(turbinia_processor.project, 'turbinia-project')
    self.assertEqual(turbinia_processor.turbinia_zone, 'europe-west1')
    self.assertEqual(turbinia_processor.sketch_id, 123)
    self.assertEqual(turbinia_processor.run_all_jobs, False)
    self.assertEqual(test_state.errors, [])

    # TURBINIA_REGION is dynamically generated
    # pylint: disable=no-member
    self.assertEqual(turbinia_processor.turbinia_region,
                     turbinia.turbinia_config.TURBINIA_REGION)
    # pylint: disable=protected-access
    six.assertRegex(self, turbinia_processor._output_path,
                    '(/tmp/tmp|/var/folders).+') 
开发者ID:log2timeline,项目名称:dftimewolf,代码行数:26,代码来源:turbinia.py

示例3: test_open_test_case

# 需要导入模块: import six [as 别名]
# 或者: from six import assertRegex [as 别名]
def test_open_test_case(self):
        """
        Given: FuzzLoggerCsv with a virtual file handle.
        When: Calling open_test_case with some test_case_id.
        Then: open_test_case logs as expected.
        """
        # When
        self.logger.open_test_case(
            self.some_test_case_id, name=self.some_test_case_name, index=self.some_test_case_index
        )

        # Then
        self.virtual_file.seek(0)
        six.assertRegex(
            self,
            self.virtual_file.readline(),
            LOGGER_PREAMBLE + re.escape("open test case,,,Test case " + self.some_test_case_id + "\r\n"),
        ) 
开发者ID:jtpereyda,项目名称:boofuzz,代码行数:20,代码来源:test_fuzz_logger_csv.py

示例4: test_log_info

# 需要导入模块: import six [as 别名]
# 或者: from six import assertRegex [as 别名]
def test_log_info(self):
        """
        Given: FuzzLoggerCsv with a virtual file handle.
        When: Calling open_test_case with some test_case_id.
         and: Calling log_info with some description.
        Then: open_test_case logs as expected.
         and: log_info logs as expected.
        """
        # When
        self.logger.open_test_case(
            self.some_test_case_id, name=self.some_test_case_name, index=self.some_test_case_index
        )
        self.logger.log_info(self.some_log_info_msg)

        # Then
        self.virtual_file.seek(0)
        six.assertRegex(
            self,
            self.virtual_file.readline(),
            LOGGER_PREAMBLE + re.escape("open test case,,,Test case " + self.some_test_case_id + "\r\n"),
        )
        six.assertRegex(
            self, self.virtual_file.readline(), LOGGER_PREAMBLE + re.escape("info,,," + self.some_log_info_msg + "\r\n")
        ) 
开发者ID:jtpereyda,项目名称:boofuzz,代码行数:26,代码来源:test_fuzz_logger_csv.py

示例5: test_log_fail

# 需要导入模块: import six [as 别名]
# 或者: from six import assertRegex [as 别名]
def test_log_fail(self):
        """
        Given: FuzzLoggerCsv with a virtual file handle.
        When: Calling open_test_case with some test_case_id.
         and: Calling log_fail with some description.
        Then: open_test_case logs as expected.
         and: log_fail logs as expected.
        """
        # When
        self.logger.open_test_case(
            self.some_test_case_id, name=self.some_test_case_name, index=self.some_test_case_index
        )
        self.logger.log_fail(self.some_log_fail_msg)

        # Then
        self.virtual_file.seek(0)
        six.assertRegex(
            self,
            self.virtual_file.readline(),
            LOGGER_PREAMBLE + re.escape("open test case,,,Test case " + self.some_test_case_id + "\r\n"),
        )
        six.assertRegex(
            self, self.virtual_file.readline(), LOGGER_PREAMBLE + re.escape("fail,,," + self.some_log_fail_msg + "\r\n")
        ) 
开发者ID:jtpereyda,项目名称:boofuzz,代码行数:26,代码来源:test_fuzz_logger_csv.py

示例6: test_log_pass

# 需要导入模块: import six [as 别名]
# 或者: from six import assertRegex [as 别名]
def test_log_pass(self):
        """
        Given: FuzzLoggerCsv with a virtual file handle.
        When: Calling open_test_case with some test_case_id.
         and: Calling log_pass with some description.
        Then: open_test_case logs as expected.
         and: log_pass logs as expected.
        """
        # When
        self.logger.open_test_case(
            self.some_test_case_id, name=self.some_test_case_name, index=self.some_test_case_index
        )
        self.logger.log_pass(self.some_log_pass_msg)

        # Then
        self.virtual_file.seek(0)
        six.assertRegex(
            self,
            self.virtual_file.readline(),
            LOGGER_PREAMBLE + re.escape("open test case,,,Test case " + self.some_test_case_id + "\r\n"),
        )
        six.assertRegex(
            self, self.virtual_file.readline(), LOGGER_PREAMBLE + re.escape("pass,,," + self.some_log_pass_msg + "\r\n")
        ) 
开发者ID:jtpereyda,项目名称:boofuzz,代码行数:26,代码来源:test_fuzz_logger_csv.py

示例7: test_open_test_step_empty

# 需要导入模块: import six [as 别名]
# 或者: from six import assertRegex [as 别名]
def test_open_test_step_empty(self):
        """
        Given: FuzzLoggerCsv with a virtual file handle.
        When: Calling open_test_case with some test_case_id.
         and: Calling open_test_step with an empty string.
        Then: open_test_step logs with a zero-length description.
        """
        # When
        self.logger.open_test_case(
            self.some_test_case_id, name=self.some_test_case_name, index=self.some_test_case_index
        )
        self.logger.open_test_step("")

        # Then
        self.virtual_file.seek(0)
        six.assertRegex(
            self,
            self.virtual_file.readline(),
            LOGGER_PREAMBLE + re.escape("open test case,,,Test case " + self.some_test_case_id + "\r\n"),
        )
        six.assertRegex(self, self.virtual_file.readline(), LOGGER_PREAMBLE + re.escape("open step,,,\r\n")) 
开发者ID:jtpereyda,项目名称:boofuzz,代码行数:23,代码来源:test_fuzz_logger_csv.py

示例8: test_log_check_empty

# 需要导入模块: import six [as 别名]
# 或者: from six import assertRegex [as 别名]
def test_log_check_empty(self):
        """
        Given: FuzzLoggerCsv with a virtual file handle.
        When: Calling open_test_case with some test_case_id.
         and: Calling log_check with an empty string.
        Then: log_check logs with a zero-length description.
        """
        # When
        self.logger.open_test_case(
            self.some_test_case_id, name=self.some_test_case_name, index=self.some_test_case_index
        )
        self.logger.log_check("")

        # Then
        self.virtual_file.seek(0)
        six.assertRegex(
            self,
            self.virtual_file.readline(),
            LOGGER_PREAMBLE + re.escape("open test case,,,Test case " + self.some_test_case_id + "\r\n"),
        )
        six.assertRegex(self, self.virtual_file.readline(), LOGGER_PREAMBLE + re.escape("check,,,\r\n")) 
开发者ID:jtpereyda,项目名称:boofuzz,代码行数:23,代码来源:test_fuzz_logger_csv.py

示例9: test_log_error_empty

# 需要导入模块: import six [as 别名]
# 或者: from six import assertRegex [as 别名]
def test_log_error_empty(self):
        """
        Given: FuzzLoggerCsv with a virtual file handle.
        When: Calling open_test_case with some test_case_id.
         and: Calling log_error with an empty string.
        Then: log_error logs with a zero-length description.
        """
        # When
        self.logger.open_test_case(
            self.some_test_case_id, name=self.some_test_case_name, index=self.some_test_case_index
        )
        self.logger.log_error("")

        # Then
        self.virtual_file.seek(0)
        six.assertRegex(
            self,
            self.virtual_file.readline(),
            LOGGER_PREAMBLE + re.escape("open test case,,,Test case " + self.some_test_case_id + "\r\n"),
        )
        six.assertRegex(self, self.virtual_file.readline(), LOGGER_PREAMBLE + re.escape("error,,,\r\n")) 
开发者ID:jtpereyda,项目名称:boofuzz,代码行数:23,代码来源:test_fuzz_logger_csv.py

示例10: test_log_fail_empty

# 需要导入模块: import six [as 别名]
# 或者: from six import assertRegex [as 别名]
def test_log_fail_empty(self):
        """
        Given: FuzzLoggerCsv with a virtual file handle.
        When: Calling open_test_case with some test_case_id.
         and: Calling log_fail with no argument.
        Then: log_fail logs with a zero-length description.
        """
        # When
        self.logger.open_test_case(
            self.some_test_case_id, name=self.some_test_case_name, index=self.some_test_case_index
        )
        self.logger.log_fail("")

        # Then
        self.virtual_file.seek(0)
        six.assertRegex(
            self,
            self.virtual_file.readline(),
            LOGGER_PREAMBLE + re.escape("open test case,,,Test case " + self.some_test_case_id + "\r\n"),
        )
        six.assertRegex(self, self.virtual_file.readline(), LOGGER_PREAMBLE + re.escape("fail,,,\r\n")) 
开发者ID:jtpereyda,项目名称:boofuzz,代码行数:23,代码来源:test_fuzz_logger_csv.py

示例11: test_log_pass_empty

# 需要导入模块: import six [as 别名]
# 或者: from six import assertRegex [as 别名]
def test_log_pass_empty(self):
        """
        Given: FuzzLoggerCsv with a virtual file handle.
        When: Calling open_test_case with some test_case_id.
         and: Calling log_pass with no argument.
        Then: log_pass logs with a zero-length description.
        """
        # When
        self.logger.open_test_case(
            self.some_test_case_id, name=self.some_test_case_name, index=self.some_test_case_index
        )
        self.logger.log_pass("")

        # Then
        self.virtual_file.seek(0)
        six.assertRegex(
            self,
            self.virtual_file.readline(),
            LOGGER_PREAMBLE + re.escape("open test case,,,Test case " + self.some_test_case_id + "\r\n"),
        )
        six.assertRegex(self, self.virtual_file.readline(), LOGGER_PREAMBLE + re.escape("pass,,,\r\n")) 
开发者ID:jtpereyda,项目名称:boofuzz,代码行数:23,代码来源:test_fuzz_logger_csv.py

示例12: assertQuickReplyLinks

# 需要导入模块: import six [as 别名]
# 或者: from six import assertRegex [as 别名]
def assertQuickReplyLinks(self, output):
        """Assert reply links created by setup_quick_replies are present."""
        link = r'data-qr="%s">\s*%s\s*</a>'
        six.assertRegex(
            self, output.get_data(as_text=True), link % (self.r1, self.sr1)
        )
        six.assertRegex(
            self, output.get_data(as_text=True), link % (self.r2, self.sr2)
        ) 
开发者ID:Pagure,项目名称:pagure,代码行数:11,代码来源:test_pagure_flask_ui_quick_reply.py

示例13: test_print_report

# 需要导入模块: import six [as 别名]
# 或者: from six import assertRegex [as 别名]
def test_print_report(self):
        x = self.x
        self.f.apply((chainer.Variable(x),))
        self.f.apply((chainer.Variable(x),))
        io = six.StringIO()
        self.h.print_report(unit=self.unit, file=io)
        expect = r'''\AFunctionName +ElapsedTime +Occurrence
 +Exp +[0-9.\-e]+(.s|sec) +[0-9]+
\Z'''
        actual = io.getvalue()
        six.assertRegex(self, actual, expect) 
开发者ID:chainer,项目名称:chainer,代码行数:13,代码来源:test_timer.py

示例14: test_print_report

# 需要导入模块: import six [as 别名]
# 或者: from six import assertRegex [as 别名]
def test_print_report(self):
        io = six.StringIO()
        self.h.print_report(unit=self.unit, file=io)
        expect = r'''\AFunctionName  UsedBytes  AcquiredBytes  Occurrence
 +Exp +[0-9.\-e]+.?B +[0-9.\-e]+.?B +[0-9]+
 +ReLU +[0-9.\-e]+.?B +[0-9.\-e]+.?B +[0-9]+$
'''
        actual = io.getvalue()
        six.assertRegex(self, actual, expect) 
开发者ID:chainer,项目名称:chainer,代码行数:11,代码来源:test_cupy_memory_profile.py

示例15: testInvalidBasicType

# 需要导入模块: import six [as 别名]
# 或者: from six import assertRegex [as 别名]
def testInvalidBasicType(self):
    with self.assertRaises(SyntaxError) as assert_raises:
      self._parse_config("""
        scope/some_fn.arg1 = None
        scope/some_fn.arg2 = Garbage  # <-- Not a valid Python value.
      """)
    self.assertEqual(assert_raises.exception.lineno, 3)
    self.assertEqual(assert_raises.exception.offset, 29)
    self.assertEqual(
        assert_raises.exception.text.strip(),
        'scope/some_fn.arg2 = Garbage  # <-- Not a valid Python value.')
    six.assertRegex(self, str(assert_raises.exception),
                    r"malformed (string|node or string: <_ast.Name [^\n]+>)\n"
                    r"    Failed to parse token 'Garbage' \(line 3\)") 
开发者ID:google,项目名称:gin-config,代码行数:16,代码来源:config_parser_test.py


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