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


Python QuoteChecker.parse_options方法代码示例

本文整理汇总了Python中flake8_quotes.QuoteChecker.parse_options方法的典型用法代码示例。如果您正苦于以下问题:Python QuoteChecker.parse_options方法的具体用法?Python QuoteChecker.parse_options怎么用?Python QuoteChecker.parse_options使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在flake8_quotes.QuoteChecker的用法示例。


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

示例1: test_escapes_allowed

# 需要导入模块: from flake8_quotes import QuoteChecker [as 别名]
# 或者: from flake8_quotes.QuoteChecker import parse_options [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())), [])
开发者ID:zheller,项目名称:flake8-quotes,代码行数:10,代码来源:test_checks.py

示例2: test_require_double_docstring_double_present

# 需要导入模块: from flake8_quotes import QuoteChecker [as 别名]
# 或者: from flake8_quotes.QuoteChecker import parse_options [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'},
        ])
开发者ID:zheller,项目名称:flake8-quotes,代码行数:59,代码来源:test_docstring_checks.py

示例3: test_doubles_alias

# 需要导入模块: from flake8_quotes import QuoteChecker [as 别名]
# 或者: from flake8_quotes.QuoteChecker import parse_options [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'},
        ])
开发者ID:zheller,项目名称:flake8-quotes,代码行数:12,代码来源:test_checks.py

示例4: setUp

# 需要导入模块: from flake8_quotes import QuoteChecker [as 别名]
# 或者: from flake8_quotes.QuoteChecker import parse_options [as 别名]
 def setUp(self):
     class SinglesOptions():
         inline_quotes = '"'
     QuoteChecker.parse_options(SinglesOptions)
开发者ID:jdavidheiser,项目名称:flake8-quotes,代码行数:6,代码来源:test_checks.py

示例5: setUp

# 需要导入模块: from flake8_quotes import QuoteChecker [as 别名]
# 或者: from flake8_quotes.QuoteChecker import parse_options [as 别名]
 def setUp(self):
     class DoublesAliasOptions():
         inline_quotes = 'single'
         multiline_quotes = 'single'
     QuoteChecker.parse_options(DoublesAliasOptions)
开发者ID:zheller,项目名称:flake8-quotes,代码行数:7,代码来源:test_checks.py


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