本文整理汇总了Python中flake8_quotes.QuoteChecker.get_quotes_errors方法的典型用法代码示例。如果您正苦于以下问题:Python QuoteChecker.get_quotes_errors方法的具体用法?Python QuoteChecker.get_quotes_errors怎么用?Python QuoteChecker.get_quotes_errors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flake8_quotes.QuoteChecker
的用法示例。
在下文中一共展示了QuoteChecker.get_quotes_errors方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_require_double_docstring_double_present
# 需要导入模块: from flake8_quotes import QuoteChecker [as 别名]
# 或者: from flake8_quotes.QuoteChecker import get_quotes_errors [as 别名]
def test_require_double_docstring_double_present(self):
class Options():
inline_quotes = 'single'
multiline_quotes = 'single'
docstring_quotes = 'double'
QuoteChecker.parse_options(Options)
multiline_checker = QuoteChecker(
None,
filename=get_absolute_path('data/docstring_doubles.py')
)
self.assertEqual(list(multiline_checker.get_quotes_errors(multiline_checker.get_file_contents())), [
{'col': 0, 'line': 5, 'message': 'Q001 Remove bad quotes from multiline string'},
{'col': 4, 'line': 16, 'message': 'Q001 Remove bad quotes from multiline string'},
{'col': 20, 'line': 21, 'message': 'Q001 Remove bad quotes from multiline string'},
{'col': 8, 'line': 30, 'message': 'Q001 Remove bad quotes from multiline string'},
{'col': 12, 'line': 35, 'message': 'Q001 Remove bad quotes from multiline string'},
])
multiline_checker = QuoteChecker(
None,
filename=get_absolute_path('data/docstring_doubles_module_multiline.py')
)
self.assertEqual(list(multiline_checker.get_quotes_errors(multiline_checker.get_file_contents())), [
{'col': 0, 'line': 4, 'message': 'Q001 Remove bad quotes from multiline string'},
{'col': 0, 'line': 9, 'message': 'Q001 Remove bad quotes from multiline string'},
])
multiline_checker = QuoteChecker(
None,
filename=get_absolute_path('data/docstring_doubles_module_singleline.py')
)
self.assertEqual(list(multiline_checker.get_quotes_errors(multiline_checker.get_file_contents())), [
{'col': 0, 'line': 2, 'message': 'Q001 Remove bad quotes from multiline string'},
{'col': 0, 'line': 6, 'message': 'Q001 Remove bad quotes from multiline string'},
])
multiline_checker = QuoteChecker(
None,
filename=get_absolute_path('data/docstring_doubles_class.py')
)
self.assertEqual(list(multiline_checker.get_quotes_errors(multiline_checker.get_file_contents())), [
{'col': 4, 'line': 3, 'message': 'Q001 Remove bad quotes from multiline string'},
{'col': 22, 'line': 5, 'message': 'Q001 Remove bad quotes from multiline string'},
])
multiline_checker = QuoteChecker(
None,
filename=get_absolute_path('data/docstring_doubles_function.py')
)
self.assertEqual(list(multiline_checker.get_quotes_errors(multiline_checker.get_file_contents())), [
{'col': 4, 'line': 3, 'message': 'Q001 Remove bad quotes from multiline string'},
{'col': 4, 'line': 11, 'message': 'Q001 Remove bad quotes from multiline string'},
{'col': 38, 'line': 15, 'message': 'Q001 Remove bad quotes from multiline string'},
{'col': 4, 'line': 17, 'message': 'Q001 Remove bad quotes from multiline string'},
{'col': 4, 'line': 21, 'message': 'Q001 Remove bad quotes from multiline string'},
])
示例2: test_doubles
# 需要导入模块: from flake8_quotes import QuoteChecker [as 别名]
# 或者: from flake8_quotes.QuoteChecker import get_quotes_errors [as 别名]
def test_doubles(self):
doubles_checker = QuoteChecker(None, filename=get_absolute_path('data/doubles_wrapped.py'))
self.assertEqual(list(doubles_checker.get_quotes_errors(doubles_checker.get_file_contents())), [])
doubles_checker = QuoteChecker(None, filename=get_absolute_path('data/doubles.py'))
self.assertEqual(list(doubles_checker.get_quotes_errors(doubles_checker.get_file_contents())), [
{'col': 24, 'line': 1, 'message': 'Q000 Remove bad quotes'},
{'col': 24, 'line': 2, 'message': 'Q000 Remove bad quotes'},
{'col': 24, 'line': 3, 'message': 'Q000 Remove bad quotes'},
])
示例3: test_escapes_allowed
# 需要导入模块: from flake8_quotes import QuoteChecker [as 别名]
# 或者: from flake8_quotes.QuoteChecker import get_quotes_errors [as 别名]
def test_escapes_allowed(self):
class Options():
inline_quotes = "'"
avoid_escape = False
QuoteChecker.parse_options(Options)
doubles_checker = QuoteChecker(None, filename=get_absolute_path('data/doubles_escaped.py'))
self.assertEqual(list(doubles_checker.get_quotes_errors(doubles_checker.get_file_contents())), [])
示例4: test_doubles_alias
# 需要导入模块: from flake8_quotes import QuoteChecker [as 别名]
# 或者: from flake8_quotes.QuoteChecker import get_quotes_errors [as 别名]
def test_doubles_alias(self):
class Options():
inline_quotes = 'double'
multiline_quotes = 'single'
QuoteChecker.parse_options(Options)
multiline_checker = QuoteChecker(None, filename=get_absolute_path('data/multiline_string.py'))
self.assertEqual(list(multiline_checker.get_quotes_errors(multiline_checker.get_file_contents())), [
{'col': 4, 'line': 1, 'message': 'Q001 Remove bad quotes from multiline string'},
])
示例5: test_singles
# 需要导入模块: from flake8_quotes import QuoteChecker [as 别名]
# 或者: from flake8_quotes.QuoteChecker import get_quotes_errors [as 别名]
def test_singles(self):
singles_checker = QuoteChecker(None, filename=get_absolute_path('data/singles.py'))
self.assertEqual(list(singles_checker.get_quotes_errors(singles_checker.get_file_contents())), [
{'col': 24, 'line': 1, 'message': 'Q000 Remove bad quotes.'}
])
示例6: test_wrapped
# 需要导入模块: from flake8_quotes import QuoteChecker [as 别名]
# 或者: from flake8_quotes.QuoteChecker import get_quotes_errors [as 别名]
def test_wrapped(self):
singles_checker = QuoteChecker(None, filename=get_absolute_path('data/singles_wrapped.py'))
self.assertEqual(list(singles_checker.get_quotes_errors(singles_checker.get_file_contents())), [])
示例7: test_multiline_string
# 需要导入模块: from flake8_quotes import QuoteChecker [as 别名]
# 或者: from flake8_quotes.QuoteChecker import get_quotes_errors [as 别名]
def test_multiline_string(self):
doubles_checker = QuoteChecker(None, filename=get_absolute_path('data/doubles_multiline_string.py'))
self.assertEqual(list(doubles_checker.get_quotes_errors(doubles_checker.get_file_contents())), [])
示例8: test_escapes
# 需要导入模块: from flake8_quotes import QuoteChecker [as 别名]
# 或者: from flake8_quotes.QuoteChecker import get_quotes_errors [as 别名]
def test_escapes(self):
doubles_checker = QuoteChecker(None, filename=get_absolute_path('data/doubles_escaped.py'))
self.assertEqual(list(doubles_checker.get_quotes_errors(doubles_checker.get_file_contents())), [
{'col': 25, 'line': 1, 'message': 'Q003 Change outer quotes to avoid escaping inner quotes'},
])
示例9: test_multiline_string
# 需要导入模块: from flake8_quotes import QuoteChecker [as 别名]
# 或者: from flake8_quotes.QuoteChecker import get_quotes_errors [as 别名]
def test_multiline_string(self):
doubles_checker = QuoteChecker(None, filename=get_absolute_path('data/doubles_multiline_string.py'))
self.assertEqual(list(doubles_checker.get_quotes_errors(doubles_checker.get_file_contents())), [
{'col': 4, 'line': 1, 'message': 'Q001 Remove bad quotes from multiline string'},
])