本文整理汇总了Python中tests.LocalBearTestHelper.verify_local_bear函数的典型用法代码示例。如果您正苦于以下问题:Python verify_local_bear函数的具体用法?Python verify_local_bear怎么用?Python verify_local_bear使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了verify_local_bear函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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.',
示例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,))
示例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"})
示例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"})
示例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"},
)
示例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,))
示例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'})
示例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})
示例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=(),
示例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,
示例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"})
示例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,))
示例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})
示例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,))
示例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)