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

Python LocalBearTestHelper.verify_local_bear函数代码示例

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

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



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

示例1: SkipTest

from bears.natural_language.LanguageToolBear import LanguageToolBear
from tests.BearTestHelper import generate_skip_decorator
from tests.LocalBearTestHelper import verify_local_bear

try:
    import language_check
    import guess_language
    language_check
    guess_language
except ImportError as err:
    raise SkipTest(str(err))

LanguageToolBearTest = verify_local_bear(
    LanguageToolBear,
    valid_files=('A correct English sentence sounds nice to everyone.',
                 'Ein korrekter englischer Satz klingt für alle gut.'),
    invalid_files=('  ',
                   'asdgaasdfgahsadf',
                   '"quoted"'))


LanguageToolBearLanguageTest = verify_local_bear(
    LanguageToolBear,
    valid_files=('A correct English sentence sounds nice to everyone.',),
    invalid_files=('Ein korrekter englischer Satz klingt für alle gut.',),
    settings={'language': 'en-US'})


LanguageToolBearDisableRulesTest = verify_local_bear(
    LanguageToolBear,
    valid_files=('Line without unnecessary spaces at the start.',
开发者ID:coala-analyzer,项目名称:coala-bears,代码行数:31,代码来源:LanguageToolBearTest.py


示例2: verify_local_bear

from bears.configfiles.DockerfileLintBear import DockerfileLintBear
from tests.LocalBearTestHelper import verify_local_bear

good_file = """
FROM ubuntu:14.04

# Install basic tools
RUN apt-get -y -qq update
RUN apt-get -y -qq upgrade
""".splitlines(keepends=True)


bad_file = """
FROM ubuntu:14.04

# Install basic tools
apt-get -y -qq update
apt-get -y -qq upgrade
""".splitlines(keepends=True)


DockerfileLintBearTest = verify_local_bear(DockerfileLintBear,
                                           valid_files=(good_file,),
                                           invalid_files=(bad_file,))
开发者ID:1suryansh,项目名称:coala-bears,代码行数:24,代码来源:DockerfileLintBearTest.py


示例3: addOne

var _ os.File // for "os"
""".splitlines(keepends=True)


bad_file = """
package pkg

func addOne(x int) int {
  x += 1
  return x
}

func subOneInLoop(y int) {
  for ; y > 0; y -= 1 {
  }
}
""".splitlines(keepends=True)


GoLintBearTest = verify_local_bear(GoLintBear,
                                   valid_files=(good_file,),
                                   invalid_files=(bad_file,))


GoLintBearWithSettingsTest = verify_local_bear(
    GoLintBear,
    valid_files=(bad_file, good_file),
    invalid_files=(),
    settings={"golint_cli_options": "-min_confidence=1"})
开发者ID:1suryansh,项目名称:coala-bears,代码行数:29,代码来源:GoLintBearTest.py


示例4: verify_local_bear

from bears.python.PyImportSortBear import PyImportSortBear
from tests.LocalBearTestHelper import verify_local_bear

PyImportSortBearTest = verify_local_bear(PyImportSortBear,
                                         (["import os\n", "import sys\n"],
                                          ("import os\n", "import sys\n")),
                                         (["import sys\n", "import os\n"],
                                          ("import sys\n", "import os\n")))

PyImportSortBearConfigsTest = verify_local_bear(
    PyImportSortBear,
    (("from os import read\n", "from sys import *\n"),),
    (("from os import read\n", "from os import *\n"),),
    settings={"combine_star_imports": True})

PyImportSortBearIgnoredConfigsTest = verify_local_bear(
    PyImportSortBear,
    (("import xyz\n", "\n", "import abc\n"),
     ("from xyz import *\n", "\n", "import abc\n")),
    (("import xyz\n", "import abc\n"),
     ("import abc\n", "import xyz\n")),
    settings={"known_standard_library_imports": "xyz",
              "known_first_party_imports": "abc"})
开发者ID:1suryansh,项目名称:coala-bears,代码行数:23,代码来源:PyImportSortBearTest.py


示例5: verify_local_bear

from bears.hypertext.HTMLLintBear import HTMLLintBear
from tests.LocalBearTestHelper import verify_local_bear

test_file = """
<html>
  <body>
    <h1>Hello, world!</h1>
  </body>
</html>
"""

HTMLLintBearTest = verify_local_bear(
    HTMLLintBear, valid_files=(), invalid_files=(test_file,), tempfile_kwargs={"suffix": ".html"}
)

HTMLLintBearIgnoreTest = verify_local_bear(
    HTMLLintBear,
    valid_files=(test_file,),
    invalid_files=(),
    settings={"htmllint_ignore": "optional_tag"},
    tempfile_kwargs={"suffix": ".html"},
)

HTMLLintBearIgnoreQuotationTest = verify_local_bear(
    HTMLLintBear,
    valid_files=(),
    invalid_files=(test_file,),
    settings={"htmllint_ignore": "quotation"},
    tempfile_kwargs={"suffix": ".html"},
)
开发者ID:coala-analyzer,项目名称:coala-bears,代码行数:30,代码来源:HTMLLintBearTest.py


示例6: main

from bears.c_languages.CPPCleanBear import CPPCleanBear
from tests.LocalBearTestHelper import verify_local_bear

good_file = """
int main() {
    return 0;
}
""".splitlines(keepends=True)


bad_file = """
int global_var = 3;

int main() {
    return 0;
}
""".splitlines(keepends=True)


CPPCleanBearTest = verify_local_bear(CPPCleanBear,
                                     valid_files=(good_file,),
                                     invalid_files=(bad_file,))
开发者ID:1suryansh,项目名称:coala-bears,代码行数:22,代码来源:CPPCleanBearTest.py


示例7: f1

    return 0;
}""".splitlines(keepends=True)

warn_file = """
void f1(struct fred_t *p)
{
    int x;
    if (p)
        do_something(x);
}""".splitlines(keepends=True)

bad_file = """
#define f(c) { \
    char *p = new char[10];  \
    p[c] = 42; \
}
int main() {
    f(100);
    return 0;
}""".splitlines(keepends=True)


CPPCheckBearTest1 = verify_local_bear(CPPCheckBear,
                                      valid_files=(good_file, warn_file),
                                      invalid_files=(bad_file,))

CPPCheckBearTest2 = verify_local_bear(CPPCheckBear,
                                      valid_files=(good_file,),
                                      invalid_files=(warn_file, bad_file),
                                      settings={'enable': 'unusedFunction'})
开发者ID:1suryansh,项目名称:coala-bears,代码行数:30,代码来源:CPPCheckBearTest.py


示例8: Bucket

      descrip:   Water Bucket (Filled)
      price:     1.47
      quantity:  4
...
""".splitlines(keepends=True)

config_file = """
extends:
    default
rules:
    colons:
      max-spaces-after: -1
    indentation: disable
    empty-lines: disable
""".splitlines(keepends=True)


YAMLLintBear1Test = verify_local_bear(YAMLLintBear,
                                      valid_files=(),
                                      invalid_files=(test_file,))

with prepare_file(config_file,
                  filename=None,
                  force_linebreaks=True,
                  create_tempfile=True) as (conf_lines, conf_file):
    YAMLLintBear2Test = verify_local_bear(YAMLLintBear,
                                          valid_files=(test_file,),
                                          invalid_files=(),
                                          settings={
                                              'yamllint_config': conf_file})
开发者ID:1suryansh,项目名称:coala-bears,代码行数:30,代码来源:YAMLLintBearTest.py


示例9: simple

test_file1 = """
def simple():
    pass
"""


test_file2 = """
class class1():
    pass
"""

test_file3 = "def f():\n" + ("    assert True\n" * 50)


RadonBearDefaultsTest = verify_local_bear(
    RadonBear,
    valid_files=(test_file1, test_file2),
    invalid_files=(test_file3,))


RadonBearNoReportsTest = verify_local_bear(
    RadonBear,
    valid_files=(test_file1, test_file2, test_file3),
    invalid_files=(),
    settings={"radon_ranks_info": "",
              "radon_ranks_normal": "",
              "radon_ranks_major": ""})


RadonBearReportsTest = verify_local_bear(
    RadonBear,
    valid_files=(),
开发者ID:AbdealiJK,项目名称:coala-bears,代码行数:32,代码来源:RadonBearTest.py


示例10: verify_local_bear

      }
    }
  }
})()
"""

complexity_4 = """(function () {
  var foo = 1 && 1 || 0;
  if (0 || 1) {
    return;
  }
})()
"""

JSComplexityBearTest = verify_local_bear(JSComplexityBear,
                                         valid_files=(complexity_4,),
                                         invalid_files=(complexity_12,),
                                         tempfile_kwargs={"suffix": ".js"})

JSComplexityBearThresholdTest = verify_local_bear(JSComplexityBear,
                                                  valid_files=(),
                                                  invalid_files=(
                                                      complexity_4,
                                                      complexity_12),
                                                  settings={"cc_threshold": 2},
                                                  tempfile_kwargs={"suffix":
                                                                   ".js"})

# No output for non-js files
JSComplexityBearInvalidFileTest = verify_local_bear(JSComplexityBear,
                                                    valid_files=(
                                                        complexity_4,
开发者ID:caichinger,项目名称:coala-bears,代码行数:32,代码来源:JSComplexityBearTest.py


示例11: verify_local_bear

from bears.haskell.HaskellLintBear import HaskellLintBear
from tests.LocalBearTestHelper import verify_local_bear

good_file = """
myconcat = (++)
""".split("\n")

bad_file = """
myconcat a b = ((++) a b)
""".split("\n")

HaskellLintBear1Test = verify_local_bear(HaskellLintBear,
                                         valid_files=(good_file,),
                                         invalid_files=(bad_file,),
                                         tempfile_kwargs={"suffix": ".hs"})
开发者ID:ASHUGITTY,项目名称:coala-bears,代码行数:15,代码来源:HaskellLintBearTest.py


示例12: F

func F() (*MyType, int, error) { return nil, 0, errors.New("foo") }"""\
.splitlines(keepends=True)

good_file2 = """package main

import "os"

func main() {
\tf, _ := os.Open("foo")
}""".splitlines(keepends=True)

bad_file1 = """
func F() (*MyType, int, error) { return errors.New("foo") }
""".splitlines(keepends=True)

bad_file2 = """
package main

func main() {
    f, _ := os.Open("foo")
    return nil, 0, errors.New("foo")
}

""".splitlines(keepends=True)

GoReturnsBearTest = verify_local_bear(
    GoReturnsBear,
    (good_file1,
     good_file2,),
    (bad_file1, bad_file2,))
开发者ID:1suryansh,项目名称:coala-bears,代码行数:30,代码来源:GoReturnsBearTest.py


示例13: verify_local_bear

from bears.natural_language.MarkdownBear import MarkdownBear
from tests.LocalBearTestHelper import verify_local_bear

test_file1 = """1. abc
1. def
""".splitlines()


test_file2 = """1. abc
2. def
""".splitlines()


MarkdownBear1Test = verify_local_bear(MarkdownBear,
                                      valid_files=(test_file2,),
                                      invalid_files=(test_file1,))

MarkdownBear2Test = verify_local_bear(MarkdownBear,
                                      valid_files=(test_file1,),
                                      invalid_files=(test_file2,),
                                      settings={
                                          "markdown_list_increment": False})
开发者ID:ASHUGITTY,项目名称:coala-bears,代码行数:22,代码来源:MarkdownBearTest.py


示例14: verify_local_bear

from bears.natural_language.AlexBear import AlexBear
from tests.LocalBearTestHelper import verify_local_bear

good_file = ["Their network looks good."]

bad_file = ["His network looks good."]


AlexBearTest = verify_local_bear(AlexBear,
                                 valid_files=(good_file,),
                                 invalid_files=(bad_file,))
开发者ID:1suryansh,项目名称:coala-bears,代码行数:11,代码来源:AlexBearTest.py


示例15: verify_local_bear

                            "test_files",
                            "jshintconfig.json")


settings = {
    "maxstatements": "False",
    "maxparams": 10,
    "check_unused_variables": "False",
    "shadow": "False",
    "allow_last_semicolon": "True",
    "es_version": 3,
    "allow_latedef": "no_func"}


JSHintBearTest = verify_local_bear(JSHintBear,
                                   valid_files=(),
                                   invalid_files=(test_file1, test_file2,
                                                  test_file3))


JSHintBearConfigFileTest = verify_local_bear(
    JSHintBear,
    valid_files=(test_file1,),
    invalid_files=(test_file2,),
    settings={"jshint_config": jshintconfig})


JSHintBearCoafileTest = verify_local_bear(
    JSHintBear,
    invalid_files=(),
    valid_files=(test_file3, ),
    settings=settings)
开发者ID:encukou,项目名称:coala-bears,代码行数:32,代码来源:JSHintBearTest.py


示例16: verify_local_bear

"""

cliche_file = """A fine kettle of fish."""

adverb_file = """It really is an extremely hot day."""

so_file = """So it was a bad day, wasn't it?"""

illusion_file = """Many readers are not aware that the the second the is
ignored."""

weasel_file = """Some people say that weasel words are great.
"""

WriteGoodLintBearTest = verify_local_bear(WriteGoodLintBear,
                                          valid_files=(good_file,),
                                          invalid_files=(bad_file,))

WriteGoodLintBearWithPassiveTest = verify_local_bear(WriteGoodLintBear,
                                                     valid_files=(good_file,
                                                                  weasel_file,
                                                                  bad_file,
                                                                  wordy_file,
                                                                  thereIs_file,
                                                                  cliche_file,
                                                                  adverb_file,
                                                                  so_file,),
                                                     invalid_files=(
                                                         passive_file,
                                                         illusion_file),
                                                     settings={
开发者ID:AbdealiJK,项目名称:coala-bears,代码行数:31,代码来源:WriteGoodLintBearTest.py


示例17: verify_local_bear

from bears.ruby.RuboCopBear import RuboCopBear
from tests.LocalBearTestHelper import verify_local_bear

good_file = """def good_name
  test if something
end
"""

bad_file = """def badName
  test if something
end
"""


RuboCopBearTest = verify_local_bear(RuboCopBear,
                                    invalid_files=(bad_file,),
                                    valid_files=(good_file,))

# Testing Config
rubocop_config = os.path.join(os.path.dirname(__file__),
                              'test_files',
                              'rubocop_config.yml')


# bad file becomes good and vice-versa
RuboCopBearConfigFileTest = verify_local_bear(
                                RuboCopBear,
                                valid_files=(bad_file,),
                                invalid_files=(good_file,),
                                settings={'rubocop_config': rubocop_config})
开发者ID:coala-analyzer,项目名称:coala-bears,代码行数:30,代码来源:RuboCopBearTest.py


示例18: verify_local_bear

class theGangster

  wasItAGoodDay : () ->
    yes
"""


invalid_file = """
# Coffeelint is buggy here and will generate an error with invalid CSV on this
var test
"""


CoffeeLintBearTest = verify_local_bear(CoffeeLintBear,
                                       valid_files=(good_file,),
                                       invalid_files=(warning_file,
                                                      error_file,
                                                      invalid_file))


CoffeeLintBearUseEnglishOperatorTest = verify_local_bear(
    CoffeeLintBear,
    valid_files=(good_file_use_english_operator,),
    invalid_files=(bad_file_use_english_operator,),
    settings={"allow_bitwise_operators": "false",
              "consistent_line_endings_style": "unix"})


CoffeeLintBearTabWidthTest = verify_local_bear(
    CoffeeLintBear,
    valid_files=(good_file_tab_width,),
开发者ID:Ana06,项目名称:coala-bears,代码行数:31,代码来源:CoffeeLintBearTest.py


示例19: verify_local_bear

from bears.go.GofmtBear import GofmtBear
from tests.LocalBearTestHelper import verify_local_bear

GofmtBear = verify_local_bear(
    GofmtBear,
    (['package main', '', 'func main() {', '\treturn 1', '}'],),
    (['package main', 'func main() {', '    return 1', '}'],))
开发者ID:1suryansh,项目名称:coala-bears,代码行数:7,代码来源:GofmtBearTest.py


示例20: verify_local_bear

from bears.c_languages.ClangBear import ClangBear
from tests.LocalBearTestHelper import verify_local_bear


ClangBearTest = verify_local_bear(
    ClangBear,
    ('int main() {}', ),
    ('bad things, this is no C code',  # Has no fixit
     # Has a fixit and no range
     'struct { int f0; } x = { f0 :1 };',
     'int main() {int *b; return b}'),  # Has a fixit and a range
    'test.c')


ClangBearIgnoreTest = verify_local_bear(
    ClangBear,
    # Should ignore the warning, valid!
    ('struct { int f0; } x = { f0 :1 };',),
    (),
    'test.c',
    settings={'clang_cli_options': '-w'})
开发者ID:coala-analyzer,项目名称:coala-bears,代码行数:21,代码来源:ClangBearTest.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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