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


Python flake8_quotes.QuoteChecker类代码示例

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


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

示例1: test_doubles

 def test_doubles(self):
     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'},
     ])
开发者ID:zheller,项目名称:flake8-quotes,代码行数:7,代码来源:test_checks.py

示例2: test_escapes_allowed

    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,代码行数:8,代码来源:test_checks.py

示例3: test_doubles_alias

    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,代码行数:10,代码来源:test_checks.py

示例4: test_get_noqa_lines

 def test_get_noqa_lines(self):
     checker = QuoteChecker(None, filename=get_absolute_path('data/no_qa.py'))
     self.assertEqual(checker.get_noqa_lines(checker.get_file_contents()), [2])
开发者ID:jdavidheiser,项目名称:flake8-quotes,代码行数:3,代码来源:test_checks.py

示例5: test_noqa_singles

 def test_noqa_singles(self):
     checker = QuoteChecker(None, get_absolute_path('data/singles_noqa.py'))
     self.assertEqual(list(checker.run()), [])
开发者ID:jdavidheiser,项目名称:flake8-quotes,代码行数:3,代码来源:test_checks.py

示例6: test_wrapped

 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())), [])
开发者ID:jdavidheiser,项目名称:flake8-quotes,代码行数:3,代码来源:test_checks.py

示例7: setUp

 def setUp(self):
     class SinglesOptions():
         inline_quotes = '"'
     QuoteChecker.parse_options(SinglesOptions)
开发者ID:jdavidheiser,项目名称:flake8-quotes,代码行数:4,代码来源:test_checks.py

示例8: test_multiline_string

 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())), [])
开发者ID:jdavidheiser,项目名称:flake8-quotes,代码行数:3,代码来源:test_checks.py

示例9: setUp

 def setUp(self):
     class DoublesAliasOptions():
         inline_quotes = 'single'
         multiline_quotes = 'single'
     QuoteChecker.parse_options(DoublesAliasOptions)
开发者ID:zheller,项目名称:flake8-quotes,代码行数:5,代码来源:test_checks.py

示例10: test_escapes

 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'},
     ])
开发者ID:zheller,项目名称:flake8-quotes,代码行数:5,代码来源:test_checks.py

示例11: test_multiline_string

 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'},
     ])
开发者ID:zheller,项目名称:flake8-quotes,代码行数:5,代码来源:test_checks.py

示例12: test_require_double_docstring_double_present

    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,代码行数:57,代码来源:test_docstring_checks.py


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