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


Python warnings_test_common.run_linter_throw函数代码示例

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


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

示例1: test_fail_no_quotes

 def test_fail_no_quotes(self, matcher):  # suppress(no-self-use)
     """Check that style/set_var_case fails with {}, because lowercase."""
     line = gen_source_line(matcher,
                            match_transform=lambda x: x.lower())
     with ExpectedException(LinterFailure):
         run_linter_throw(line,
                          whitelist=["style/set_var_case"])
开发者ID:polysquare,项目名称:polysquare-cmake-linter,代码行数:7,代码来源:test_style_warnings.py

示例2: test_fail_bad_kw_align

 def test_fail_bad_kw_align(self):  # suppress(no-self-use)
     """style/argument_align fails if args on same line spaced unevenly."""
     with ExpectedException(LinterFailure):
         run_linter_throw("call (ONE\n"
                          "      TWO THREE\n"
                          "        FOUR)\n",
                          whitelist=["style/argument_align"])
开发者ID:polysquare,项目名称:polysquare-cmake-linter,代码行数:7,代码来源:test_style_warnings.py

示例3: test_fail_align_macro_name

 def test_fail_align_macro_name(self):  # suppress(no-self-use)
     """style/argument_align fails when args not aligned after second."""
     with ExpectedException(LinterFailure):
         run_linter_throw("macro (name TWO\n"
                          "       THREE)\n"
                          "endmacro ()\n",
                          whitelist=["style/argument_align"])
开发者ID:polysquare,项目名称:polysquare-cmake-linter,代码行数:7,代码来源:test_style_warnings.py

示例4: test_fail_mismatch_if_alt

 def test_fail_mismatch_if_alt(self, alt):
     """style/indent fails when else, elseif has mismatched indent."""
     with ExpectedException(LinterFailure):
         script = "if (COND)\n {0} (COND)\nendif ()"
         run_linter_throw(script.format(alt),
                          whitelist=["style/indent"],
                          indent=1)
开发者ID:polysquare,项目名称:polysquare-cmake-linter,代码行数:7,代码来源:test_style_warnings.py

示例5: test_fail_if_kw_not_var_align

 def test_fail_if_kw_not_var_align(self, keyword):  # suppress(no-self-use)
     """style/argument_align fails when args not aligned after second."""
     kw_len = len(keyword)
     with ExpectedException(LinterFailure):
         run_linter_throw("call (ONE\n"
                          "      {0} ONE".format(keyword) +
                          "      " + " " * kw_len + " TWO)",
                          whitelist=["style/argument_align"])
开发者ID:polysquare,项目名称:polysquare-cmake-linter,代码行数:8,代码来源:test_style_warnings.py

示例6: test_fail_variable_unused

    def test_fail_variable_unused(self, matcher):  # suppress(no-self-use)
        """Check unused/var_in_func fails when var is unused in {}."""
        call = gen_source_line(matcher)
        script = ("function (f)\n"
                  "    {0}\n"
                  "endfunction ()\n").format(call)

        with ExpectedException(LinterFailure):
            run_linter_throw(script, whitelist=["unused/var_in_func"])
开发者ID:polysquare,项目名称:polysquare-cmake-linter,代码行数:9,代码来源:test_unused_warnings.py

示例7: test_fail_other_quotes

 def test_fail_other_quotes(self, matcher):  # suppress(no-self-use)
     """Check that style/set_var_case fails with other args quoted in {}."""
     quote = "\"{0}\""
     xform = lambda x: quote.format(x)  # suppress(unnecessary-lambda,E731)
     line = gen_source_line(matcher,
                            match_transform=lambda x: x.lower(),
                            other_transform=xform)
     with ExpectedException(LinterFailure):
         run_linter_throw(line,
                          whitelist=["style/set_var_case"])
开发者ID:polysquare,项目名称:polysquare-cmake-linter,代码行数:10,代码来源:test_style_warnings.py

示例8: test_lint_fail_excessive_space

    def test_lint_fail_excessive_space(self):  # suppress(no-self-use)
        """Check that style/space_before_func fails.

        Test fails where there is more than one space between a function name
        and a call, like so

        function_name ()
        """
        with ExpectedException(LinterFailure):
            run_linter_throw("function_call  ()\n",
                             whitelist=["style/space_before_func"])
开发者ID:polysquare,项目名称:polysquare-cmake-linter,代码行数:11,代码来源:test_style_warnings.py

示例9: test_pass_use_var_autoderef

 def test_pass_use_var_autoderef(self, cmd, generator):
     """Check that unused/private_var passes when var autodereffed in {}."""
     script = ("set (_ARGUMENT 0)\n"
               "{0} ({1})\n"
               "end{0} ()\n").format(cmd, generator(lambda x: "_" + x))
     self.assertTrue(run_linter_throw(script,
                                      whitelist=["unused/private_var"]))
开发者ID:polysquare,项目名称:polysquare-cmake-linter,代码行数:7,代码来源:test_unused_warnings.py

示例10: test_pass_priv_func_as_var

 def test_pass_priv_func_as_var(self, definition):
     """unused/private passes if private function used as a variable."""
     script = ("{0} (_definition ARGUMENT)\n"
               "end{0} ()\n"
               "call (_definition)\n").format(definition)
     self.assertTrue(run_linter_throw(script,
                                      whitelist=["unused/private"]))
开发者ID:polysquare,项目名称:polysquare-cmake-linter,代码行数:7,代码来源:test_unused_warnings.py

示例11: test_pass_no_quotes

    def test_pass_no_quotes(self, matcher):
        """Check that style/set_var_case passes with {}.

        Variables set by another CMake command should only be uppercase
        """
        result = run_linter_throw(gen_source_line(matcher),
                                  whitelist=["style/set_var_case"])
        self.assertTrue(result)
开发者ID:polysquare,项目名称:polysquare-cmake-linter,代码行数:8,代码来源:test_style_warnings.py

示例12: test_pass_pub_var_unused

 def test_pass_pub_var_unused(self, matcher):
     """Check unused/private_var passes when public var is unused in {}."""
     find = matcher.find
     script = ("{0} ({1})\n").format(matcher.cmd,
                                     find.generate(matcher.sub,
                                                   lambda x: x,
                                                   lambda x: x))
     self.assertTrue(run_linter_throw(script,
                                      whitelist=["unused/private_var"]))
开发者ID:polysquare,项目名称:polysquare-cmake-linter,代码行数:9,代码来源:test_unused_warnings.py

示例13: test_pass_deref_unused

 def test_pass_deref_unused(self, matcher):
     """Check unused/var_in_func passes when deref var is set with {}."""
     call = gen_source_line(matcher,
                            match_transform=lambda x: "${" + x + "}")
     script = ("function (f)\n"
               "    {0}\n"
               "endfunction ()\n").format(call)
     self.assertTrue(run_linter_throw(script,
                                      whitelist=["unused/var_in_func"]))
开发者ID:polysquare,项目名称:polysquare-cmake-linter,代码行数:9,代码来源:test_unused_warnings.py

示例14: test_pass_compound_unused

 def test_pass_compound_unused(self, matcher):
     """Check unused/var_in_func passes if compound_lit var passed in {}."""
     call = gen_source_line(matcher,
                            match_transform=lambda x: "${" + x + "}/Other")
     script = ("function (f)\n"
               "    {0}\n"
               "endfunction ()\n").format(call)
     self.assertTrue(run_linter_throw(script,
                                      whitelist=["unused/var_in_func"]))
开发者ID:polysquare,项目名称:polysquare-cmake-linter,代码行数:9,代码来源:test_unused_warnings.py

示例15: test_pass_no_var_set

    def test_pass_no_var_set(self, matcher):
        """Check that style/set_var_case passes with {0.cmd}.

        Where no variable is actually set, then there is no linter failure
        """
        # This will trip up matchers that match other arguments
        result = run_linter_throw("{0} ()\n".format(matcher.cmd),
                                  whitelist=["style/set_var_case"])
        self.assertTrue(result)
开发者ID:polysquare,项目名称:polysquare-cmake-linter,代码行数:9,代码来源:test_style_warnings.py


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