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

Python warnings_test_common.run_linter_throw函数代码示例

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

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



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


示例16: test_pass_variable_used

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


示例17: test_pass_other_quotes

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


示例18: test_global_priv_used

 def test_global_priv_used(self):
     """Check unused/private_var passes when var is used in nested ctx."""
     script = ("function (f)\n"
               "    set_property (GLOBAL PROPERTY _VALUE)\n"
               "endfunction (f)\n"
               "function (g)\n"
               "    get_property (VAR GLOBAL PROPERTY _VALUE)\n"
               "endfunction ()\n")
     self.assertTrue(run_linter_throw(script,
                                      whitelist=["unused/private_var"]))
开发者ID:polysquare,项目名称:polysquare-cmake-linter,代码行数:10,代码来源:test_unused_warnings.py


示例19: test_pass_nested_use

 def test_pass_nested_use(self, matcher):
     """Check unused/var_in_func passes with {}, with use nested."""
     script = ("function (f)\n"
               "    {0}\n"
               "    foreach (VAR LIST)\n"
               "        message ({1} VAR)\n"
               "    endforeach ()\n"
               "endfunction ()\n").format(gen_source_line(matcher),
                                          "${VALUE}")
     self.assertTrue(run_linter_throw(script,
                                      whitelist=["unused/var_in_func"]))
开发者ID:polysquare,项目名称:polysquare-cmake-linter,代码行数:11,代码来源:test_unused_warnings.py


示例20: test_global_used

 def test_global_used(self):
     """Check unused/var_in_func passes when global property is used."""
     script = ("function (f)\n"
               "    set_property (GLOBAL PROPERTY VALUE)\n"
               "endfunction (f)\n"
               "function (g)\n"
               "    get_property (VAR GLOBAL PROPERTY VALUE)\n"
               "    message (${VAR})\n"
               "endfunction ()\n")
     self.assertTrue(run_linter_throw(script,
                                      whitelist=["unused/var_in_func"]))
开发者ID:polysquare,项目名称:polysquare-cmake-linter,代码行数:11,代码来源:test_unused_warnings.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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