repo_id string | cross_repo_split string | commit_index int32 | commit_sha string | in_repo_split string | test_file string | file_split string | split_group string | lineno int32 | col_offset int32 | assertion_type string | test_function string | prefix large_string | target string | assertion_event_type string | assertion_event_id string | assertion_anchor large_string | old_target string | old_lineno int32 | old_col_offset int32 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
wemake-services/wemake-python-styleguide | train | 193 | a147bda345bb6983bd59fed022efe475a3bfff85 | train | tests/test_visitors/test_ast/test_classes/test_base_classes/test_base_exception_base_class.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_classes/test_base_classes/test_base_exception_base_class.py | 25 | 4 | assert_* | test_base_exception_subclass | # -*- coding: utf-8 -*-
from wemake_python_styleguide.violations.best_practices import (
BaseExceptionSubclassViolation,
)
from wemake_python_styleguide.visitors.ast.classes import WrongClassVisitor
class_with_base = """
class Meta({0}):
'''Docs.'''
"""
def test_base_exception_subclass(
assert_errors,
... | [BaseExceptionSubclassViolation]) | added | de696a6a64a5a27770ebf9b7e1a6cf6dd423d47972286d4a13567a79f4f6538b | assert_*|test_base_exception_subclass|# -*- coding: utf-8 -*- from wemake_python_styleguide.violations.best_practices import ( BaseExceptionSubclassViolation, ) from wemake_python_styleguide.visitors.ast.classes import WrongClassVisitor class_with_base = """ class Meta({0}): '''Docs.''' """ def test_base_exception_subc... | null | null | null |
wemake-services/wemake-python-styleguide | train | 193 | a147bda345bb6983bd59fed022efe475a3bfff85 | train | tests/test_visitors/test_ast/test_exceptions/test_duplicate_exceptions.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_exceptions/test_duplicate_exceptions.py | 146 | 4 | assert_* | test_duplicate_exceptions | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
DuplicateExceptionViolation,
)
from wemake_python_styleguide.visitors.ast.exceptions import (
WrongTryExceptVisitor,
)
# Correct:
correct_bare_except = """
try:
...
except:
...
"""
correct_simple_... | [DuplicateExceptionViolation]) | modified | 6038ba331805d4a98e3cf22c7767c775518b1951ddea9c26e203d655ee251453 | assert_*|test_duplicate_exceptions|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( DuplicateExceptionViolation, ) from wemake_python_styleguide.visitors.ast.exceptions import ( WrongTryExceptVisitor, ) # Correct: correct_bare_except = """ try: ... except: ... """ c... | [DuplicateExceptionViolation]) | 147 | 4 |
wemake-services/wemake-python-styleguide | train | 193 | a147bda345bb6983bd59fed022efe475a3bfff85 | train | tests/test_visitors/test_ast/test_functions/test_complex_default_values.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_functions/test_complex_default_values.py | 37 | 4 | assert_* | test_wrong_function_defaults | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
ComplexDefaultValuesViolation,
)
from wemake_python_styleguide.visitors.ast.functions import (
FunctionDefinitionVisitor,
)
function_with_defaults = """
def function(self, with_default={0}):
...
"""
@... | [ComplexDefaultValuesViolation]) | modified | 4387759b5b285f16f6360ae61109aec564831fa0cb4405fe4327d43bb81cfbdb | assert_*|test_wrong_function_defaults|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( ComplexDefaultValuesViolation, ) from wemake_python_styleguide.visitors.ast.functions import ( FunctionDefinitionVisitor, ) function_with_defaults = """ def function(self, with_de... | [ComplexDefaultValuesViolation]) | 38 | 4 |
wemake-services/wemake-python-styleguide | train | 193 | a147bda345bb6983bd59fed022efe475a3bfff85 | train | tests/test_visitors/test_ast/test_statements/test_unreachable_code.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_statements/test_unreachable_code.py | 246 | 4 | assert_* | test_unreachable_code_raise | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
UnreachableCodeViolation,
)
from wemake_python_styleguide.visitors.ast.statements import (
StatementsWithBodiesVisitor,
)
# Modules:
module_template = """
{0}
{1}
"""
# Simple conditions:
if_template = "... | [UnreachableCodeViolation]) | modified | 950cbb303cf90d1b4083839bcb601abfb307a25eaf0199adc5fba28c32dd0569 | assert_*|test_unreachable_code_raise|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( UnreachableCodeViolation, ) from wemake_python_styleguide.visitors.ast.statements import ( StatementsWithBodiesVisitor, ) # Modules: module_template = """ {0} {1} """ # Simple cond... | [UnreachableCodeViolation]) | 247 | 4 |
wemake-services/wemake-python-styleguide | train | 193 | a147bda345bb6983bd59fed022efe475a3bfff85 | train | tests/test_visitors/test_ast/test_statements/test_unreachable_code.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_statements/test_unreachable_code.py | 265 | 4 | assert_* | test_unreachable_code_return | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
UnreachableCodeViolation,
)
from wemake_python_styleguide.visitors.ast.statements import (
StatementsWithBodiesVisitor,
)
# Modules:
module_template = """
{0}
{1}
"""
# Simple conditions:
if_template = "... | [UnreachableCodeViolation]) | modified | 06911ce20548c4da37b4d57e0b3d86e3403a8afe7779b17debe5c98dac598d4f | assert_*|test_unreachable_code_return|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( UnreachableCodeViolation, ) from wemake_python_styleguide.visitors.ast.statements import ( StatementsWithBodiesVisitor, ) # Modules: module_template = """ {0} {1} """ # Simple con... | [UnreachableCodeViolation]) | 266 | 4 |
wemake-services/wemake-python-styleguide | train | 193 | a147bda345bb6983bd59fed022efe475a3bfff85 | train | tests/test_visitors/test_ast/test_statements/test_unreachable_code.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_statements/test_unreachable_code.py | 291 | 4 | assert_* | test_unreachable_code_in_loops | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
UnreachableCodeViolation,
)
from wemake_python_styleguide.visitors.ast.statements import (
StatementsWithBodiesVisitor,
)
# Modules:
module_template = """
{0}
{1}
"""
# Simple conditions:
if_template = "... | [UnreachableCodeViolation]) | modified | 120d8edb78636be66b1f8c3d50b239c4b6cdf4277c6c0bd55462c754d76f5093 | assert_*|test_unreachable_code_in_loops|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( UnreachableCodeViolation, ) from wemake_python_styleguide.visitors.ast.statements import ( StatementsWithBodiesVisitor, ) # Modules: module_template = """ {0} {1} """ # Simple c... | [UnreachableCodeViolation]) | 292 | 4 |
wemake-services/wemake-python-styleguide | train | 194 | e46a6749f503c6fe58d21dd076a2d62cd4ea43d0 | train | tests/test_visitors/test_ast/test_functions/test_useless_lambda.py | test | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_functions/test_useless_lambda.py | 63 | 4 | assert_* | test_incorrect_lambda_definition | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
UselessLambdaViolation,
)
from wemake_python_styleguide.visitors.ast.functions import (
UselessLambdaDefinitionVisitor,
)
template = '{0}: {1}'
valid_calls = (
'[]',
'method',
'obj.attr',
'... | [UselessLambdaViolation]) | added | 9a9c00ce2c75ab301418c703d5de716c28bace939cfc3ae98087d04b8b1b38fe | assert_*|test_incorrect_lambda_definition|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( UselessLambdaViolation, ) from wemake_python_styleguide.visitors.ast.functions import ( UselessLambdaDefinitionVisitor, ) template = '{0}: {1}' valid_calls = ( '[]', 'method',... | null | null | null |
wemake-services/wemake-python-styleguide | train | 194 | e46a6749f503c6fe58d21dd076a2d62cd4ea43d0 | train | tests/test_visitors/test_ast/test_modules/test_empty_modules.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_modules/test_empty_modules.py | 33 | 4 | assert_* | test_simple_filename | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
EmptyModuleViolation,
)
from wemake_python_styleguide.visitors.ast.modules import (
EmptyModuleContentsVisitor,
)
@pytest.mark.parametrize('filename', [
'empty.py',
'/home/user/logic.py',
'part... | [EmptyModuleViolation]) | modified | 71141f090903e55b171f87f32c5b586b13570c51c5c4e3b6257a0e43c5191f83 | assert_*|test_simple_filename|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( EmptyModuleViolation, ) from wemake_python_styleguide.visitors.ast.modules import ( EmptyModuleContentsVisitor, ) @pytest.mark.parametrize('filename', [ 'empty.py', '/home/user/logic.py',... | [EmptyModuleViolation]) | 33 | 4 |
wemake-services/wemake-python-styleguide | train | 194 | e46a6749f503c6fe58d21dd076a2d62cd4ea43d0 | train | tests/test_visitors/test_filenames/test_module/test_module_name.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_filenames/test_module/test_module_name.py | 36 | 4 | assert_* | test_restricted_filename | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.constants import MODULE_NAMES_BLACKLIST
from wemake_python_styleguide.violations.naming import WrongModuleNameViolation
from wemake_python_styleguide.visitors.filenames.module import (
WrongModuleNameVisitor,
)
@pytest.mark.parametrize('filenam... | [WrongModuleNameViolation]) | modified | 8cacd61e96e03887874188250149b4fa5e073bcf367228fd5d2bea7c45c9ac6c | assert_*|test_restricted_filename|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.constants import MODULE_NAMES_BLACKLIST from wemake_python_styleguide.violations.naming import WrongModuleNameViolation from wemake_python_styleguide.visitors.filenames.module import ( WrongModuleNameVisitor, ) @pytest... | [WrongModuleNameViolation]) | 36 | 4 |
wemake-services/wemake-python-styleguide | train | 195 | 87865c433aec647aa12e6a2f8057d6186f527600 | train | tests/test_visitors/test_ast/test_compares/test_literal.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_compares/test_literal.py | 55 | 4 | assert_* | test_literal | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.consistency import (
ConstantCompareViolation,
)
from wemake_python_styleguide.visitors.ast.compares import CompareSanityVisitor
if_with_chained_compares1 = 'if 0 < {0} < {1}: ...'
if_with_chained_compares2 = 'if {0} > {1} > 0: ...'
i... | [ConstantCompareViolation]) | modified | 880406db51b8ecb9897d554cf31ea8884a658de96c7980078ef63f641b13d0f4 | assert_*|test_literal|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.consistency import ( ConstantCompareViolation, ) from wemake_python_styleguide.visitors.ast.compares import CompareSanityVisitor if_with_chained_compares1 = 'if 0 < {0} < {1}: ...' if_with_chained_compares2 = 'if {0} > ... | [ConstantComparisonViolation]) | 57 | 4 |
wemake-services/wemake-python-styleguide | train | 195 | 87865c433aec647aa12e6a2f8057d6186f527600 | train | tests/test_visitors/test_ast/test_compares/test_multiple_in.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_compares/test_multiple_in.py | 69 | 4 | assert_* | test_compare_with_multiple_in | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.consistency import (
MultipleInCompareViolation,
)
from wemake_python_styleguide.visitors.ast.compares import CompareSanityVisitor
if_with_multiple_in_compares = 'if {0} in {1} in {2}: ...'
if_without_multiple_in_compares = 'if {0} in... | [MultipleInCompareViolation]) | added | db9ee1ca28081579ce6c1c67aabd57ccf07b78f30a64ff52f2c2d6447ba6e702 | assert_*|test_compare_with_multiple_in|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.consistency import ( MultipleInCompareViolation, ) from wemake_python_styleguide.visitors.ast.compares import CompareSanityVisitor if_with_multiple_in_compares = 'if {0} in {1} in {2}: ...' if_without_m... | null | null | null |
wemake-services/wemake-python-styleguide | train | 195 | 87865c433aec647aa12e6a2f8057d6186f527600 | train | tests/test_visitors/test_ast/test_compares/test_redundant.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_compares/test_redundant.py | 98 | 4 | assert_* | test_multiple_compare | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.consistency import (
UselessCompareViolation,
)
from wemake_python_styleguide.visitors.ast.compares import CompareSanityVisitor
create_variables = """
variable = 1
another_variable = 2
{0}
"""
@pytest.mark.parametrize('comparators',... | [UselessCompareViolation]) | added | da87a657c4790a3c233820457302a467d586efae57b1bba52af48f9ddc7a8717 | assert_*|test_multiple_compare|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.consistency import ( UselessCompareViolation, ) from wemake_python_styleguide.visitors.ast.compares import CompareSanityVisitor create_variables = """ variable = 1 another_variable = 2 {0} """ @pytest.mark.para... | null | null | null |
wemake-services/wemake-python-styleguide | train | 195 | 87865c433aec647aa12e6a2f8057d6186f527600 | train | tests/test_visitors/test_ast/test_compares/test_simplifiable_ifs/test_simplifiable_if_expr.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_compares/test_simplifiable_ifs/test_simplifiable_if_expr.py | 54 | 4 | assert_* | test_simplifiable_exp | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
SimplifiableIfViolation,
)
from wemake_python_styleguide.visitors.ast.compares import (
WrongConditionalVisitor,
)
if_expression = '{0} if some() else {1}'
@pytest.mark.parametrize('comparators', [
('... | [SimplifiableIfViolation]) | modified | 91b201ababb3eb78360fcb25ff48703026623bce08bd87c65950616a990b3faa | assert_*|test_simplifiable_exp|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( SimplifiableIfViolation, ) from wemake_python_styleguide.visitors.ast.compares import ( WrongConditionalVisitor, ) if_expression = '{0} if some() else {1}' @pytest.mark.parametrize('comp... | [SimplifiableIfViolation]) | 54 | 4 |
wemake-services/wemake-python-styleguide | train | 195 | 87865c433aec647aa12e6a2f8057d6186f527600 | train | tests/test_visitors/test_ast/test_compares/test_simplifiable_ifs/test_simplifiable_if_node.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_compares/test_simplifiable_ifs/test_simplifiable_if_node.py | 112 | 4 | assert_* | test_simplifiable_node | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
SimplifiableIfViolation,
)
from wemake_python_styleguide.visitors.ast.compares import (
WrongConditionalVisitor,
)
# Correct:
simple_if_template = """
if some_value:
{0} = {1}
else:
{2} = {3}
"""
... | [SimplifiableIfViolation]) | modified | 73c4649049055030e210cd16fbadbbf84cdc88a2e449976786c201e8b22fbe65 | assert_*|test_simplifiable_node|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( SimplifiableIfViolation, ) from wemake_python_styleguide.visitors.ast.compares import ( WrongConditionalVisitor, ) # Correct: simple_if_template = """ if some_value: {0} = {1} else: {2}... | [SimplifiableIfViolation]) | 112 | 4 |
wemake-services/wemake-python-styleguide | train | 195 | 87865c433aec647aa12e6a2f8057d6186f527600 | train | tests/test_visitors/test_ast/test_compares/test_unpythonic/test_useless_len.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_compares/test_unpythonic/test_useless_len.py | 35 | 4 | assert_* | test_useless_len_call | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
UselessLenCompareViolation,
)
from wemake_python_styleguide.visitors.ast.compares import CompareSanityVisitor
@pytest.mark.parametrize('code', [
'len(some) > 0',
'len(some) >= 0',
'len(some) != 0',... | [UselessLenCompareViolation]) | added | c2e952ef260aaf6a3aba922469dd55930716f4d0ddcf54ba80cefcfe54307473 | assert_*|test_useless_len_call|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( UselessLenCompareViolation, ) from wemake_python_styleguide.visitors.ast.compares import CompareSanityVisitor @pytest.mark.parametrize('code', [ 'len(some) > 0', 'len(some) >= 0', 'len(s... | null | null | null |
wemake-services/wemake-python-styleguide | train | 195 | 87865c433aec647aa12e6a2f8057d6186f527600 | train | tests/test_visitors/test_ast/test_conditions/test_redundant_returnin_else.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_conditions/test_redundant_returnin_else.py | 104 | 4 | assert_* | test_else_that_can_be_removed_in_module | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
UselessReturningElseViolation,
)
from wemake_python_styleguide.visitors.ast.conditions import IfStatementVisitor
function_level_condition = """
def function():
if some_condition:
{0}
else:
... | [UselessReturningElseViolation]) | modified | 2b7a5b371c7e36a2b8c2453f482f9cc25e7425666906cb296b813d388b97080f | assert_*|test_else_that_can_be_removed_in_module|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( UselessReturningElseViolation, ) from wemake_python_styleguide.visitors.ast.conditions import IfStatementVisitor function_level_condition = """ def function(): if some_... | [RedundantReturningElseViolation]) | 104 | 4 |
wemake-services/wemake-python-styleguide | train | 195 | 87865c433aec647aa12e6a2f8057d6186f527600 | train | tests/test_visitors/test_ast/test_exceptions/test_try_finally.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_exceptions/test_try_finally.py | 62 | 4 | assert_* | test_wrong_finally | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
UselessFinallyViolation,
)
from wemake_python_styleguide.visitors.ast.exceptions import (
WrongTryExceptVisitor,
)
right_try_example = """
try:
...
except:
...
"""
wrong_try_example = """
try:
... | [UselessFinallyViolation]) | modified | 901f69bf44da0bd2f9c40556bd85b4e1a97053f2017ea06483bffca782716b5e | assert_*|test_wrong_finally|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( UselessFinallyViolation, ) from wemake_python_styleguide.visitors.ast.exceptions import ( WrongTryExceptVisitor, ) right_try_example = """ try: ... except: ... """ wrong_try_example = """ t... | [RedundantFinallyViolation]) | 62 | 4 |
wemake-services/wemake-python-styleguide | train | 196 | 515b8670b4a74d3fbedcb0b8bd1753337d3be3d9 | train | tests/test_visitors/test_ast/test_compares/test_unpythonic/test_useless_len.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_compares/test_unpythonic/test_useless_len.py | 38 | 4 | assert_* | test_useless_len_call | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
UselessLenCompareViolation,
)
from wemake_python_styleguide.visitors.ast.compares import CompareSanityVisitor
@pytest.mark.parametrize('code', [
'len(some) > 0',
'len(some) >= 0',
'len(some) != 0',... | [UselessLenCompareViolation]) | modified | 4887fe7f0a1708590503c1a85dc0ba926acfe503bf101d3d0448078a6a678009 | assert_*|test_useless_len_call|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( UselessLenCompareViolation, ) from wemake_python_styleguide.visitors.ast.compares import CompareSanityVisitor @pytest.mark.parametrize('code', [ 'len(some) > 0', 'len(some) >= 0', 'len(s... | [UselessLenCompareViolation]) | 35 | 4 |
wemake-services/wemake-python-styleguide | train | 196 | 515b8670b4a74d3fbedcb0b8bd1753337d3be3d9 | train | tests/test_visitors/test_ast/test_conditions/test_same_element.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_conditions/test_same_element.py | 67 | 4 | assert_* | test_duplicate_element | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
SameElementsInConditionViolation,
)
from wemake_python_styleguide.visitors.ast.conditions import (
BooleanConditionVisitor,
)
@pytest.mark.parametrize('code', [
'some or other',
'other and some',
... | [SameElementsInConditionViolation]) | added | 36ce90ac633c8be2e7e5fb4c680427fd6697616ce18322290258318281a50538 | assert_*|test_duplicate_element|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( SameElementsInConditionViolation, ) from wemake_python_styleguide.visitors.ast.conditions import ( BooleanConditionVisitor, ) @pytest.mark.parametrize('code', [ 'some or other', 'other ... | null | null | null |
wemake-services/wemake-python-styleguide | train | 197 | 87cc9efe8893df9283d36833fe30cfbd4989c602 | train | tests/test_visitors/test_ast/test_compares/test_unary_compare/test_not_with_compare.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_compares/test_unary_compare/test_not_with_compare.py | 42 | 4 | assert_* | test_incorrect_unary_not_operator | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
NotOperatorWithCompareViolation,
)
from wemake_python_styleguide.visitors.ast.compares import UnaryCompareVisitor
@pytest.mark.parametrize('code', [
'not x > 5',
'not (x > 5)',
'not some() > call.o... | [NotOperatorWithCompareViolation]) | added | eca0b0abd63c1ff62784c8be048b30d81dff95e69d77546a287d2acbbf689046 | assert_*|test_incorrect_unary_not_operator|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( NotOperatorWithCompareViolation, ) from wemake_python_styleguide.visitors.ast.compares import UnaryCompareVisitor @pytest.mark.parametrize('code', [ 'not x > 5', 'not (x > 5)... | null | null | null |
wemake-services/wemake-python-styleguide | train | 198 | d024a5d8d6ffa55a563be90bc81081129bf76970 | train | tests/test_visitors/test_ast/test_compares/test_heterogenous_compare.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_compares/test_heterogenous_compare.py | 41 | 4 | assert_* | test_heterogenous_compare | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
HeterogenousCompareViolation,
)
from wemake_python_styleguide.visitors.ast.compares import CompareSanityVisitor
@pytest.mark.parametrize('code', [
'x > y < z',
'x >= y < z',
'x > y <= z',
'x >=... | [HeterogenousCompareViolation]) | added | b06a81b132754d09806540fbf2d80b662c80bbeb0f60f994445535ae74faacd0 | assert_*|test_heterogenous_compare|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( HeterogenousCompareViolation, ) from wemake_python_styleguide.visitors.ast.compares import CompareSanityVisitor @pytest.mark.parametrize('code', [ 'x > y < z', 'x >= y < z', 'x > y <... | null | null | null |
wemake-services/wemake-python-styleguide | train | 198 | d024a5d8d6ffa55a563be90bc81081129bf76970 | train | tests/test_visitors/test_ast/test_compares/test_multiple_in.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_compares/test_multiple_in.py | 71 | 4 | assert_* | test_compare_with_multiple_in | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.consistency import (
MultipleInCompareViolation,
)
from wemake_python_styleguide.visitors.ast.compares import CompareSanityVisitor
if_with_multiple_in_compares = 'if {0} in {1} in {2}: ...'
if_without_multiple_in_compares = 'if {0} in... | [MultipleInCompareViolation]) | modified | ed3323da9d80f9aab2dd621245c5b8a8beb7ff6e44345772aa702442e1fe98d0 | assert_*|test_compare_with_multiple_in|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.consistency import ( MultipleInCompareViolation, ) from wemake_python_styleguide.visitors.ast.compares import CompareSanityVisitor if_with_multiple_in_compares = 'if {0} in {1} in {2}: ...' if_without_m... | [MultipleInCompareViolation]) | 69 | 4 |
wemake-services/wemake-python-styleguide | train | 199 | 0c30b0fa233a88cf5a4690fadf4067c82ff8a4c3 | train | tests/test_visitors/test_ast/test_compares/test_multiple_in.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_compares/test_multiple_in.py | 74 | 4 | assert_* | test_compare_with_multiple_in | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
HeterogenousCompareViolation,
)
from wemake_python_styleguide.violations.consistency import (
MultipleInCompareViolation,
)
from wemake_python_styleguide.visitors.ast.compares import CompareSanityVisitor
if... | [MultipleInCompareViolation]) | modified | 21164e523f1b7a6883433141010c2e1dc9d3d7c0e8dd91c173ca5405eb4746a8 | assert_*|test_compare_with_multiple_in|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( HeterogenousCompareViolation, ) from wemake_python_styleguide.violations.consistency import ( MultipleInCompareViolation, ) from wemake_python_styleguide.visitors.ast.compares im... | [MultipleInCompareViolation]) | 71 | 4 |
wemake-services/wemake-python-styleguide | train | 199 | 0c30b0fa233a88cf5a4690fadf4067c82ff8a4c3 | train | tests/test_visitors/test_ast/test_compares/test_multiple_in.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_compares/test_multiple_in.py | 88 | 4 | assert_* | test_compare_with_mixed_in | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
HeterogenousCompareViolation,
)
from wemake_python_styleguide.violations.consistency import (
MultipleInCompareViolation,
)
from wemake_python_styleguide.visitors.ast.compares import CompareSanityVisitor
if... | [ MultipleInCompareViolation, HeterogenousCompareViolation, ]) | added | d2d1f2e8fa7121b57dd7f13c7dfdedd34556449ee6c4a6b0576059bdaedfd081 | assert_*|test_compare_with_mixed_in|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( HeterogenousCompareViolation, ) from wemake_python_styleguide.violations.consistency import ( MultipleInCompareViolation, ) from wemake_python_styleguide.visitors.ast.compares impor... | null | null | null |
wemake-services/wemake-python-styleguide | train | 199 | 0c30b0fa233a88cf5a4690fadf4067c82ff8a4c3 | train | tests/test_visitors/test_ast/test_functions/test_useless_lambda.py | test | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_functions/test_useless_lambda.py | 39 | 4 | assert_* | test_incorrect_lambda_definition | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
UselessLambdaViolation,
)
from wemake_python_styleguide.visitors.ast.functions import (
UselessLambdaDefinitionVisitor,
)
template = '{0}: {1}'
@pytest.mark.parametrize('lambda_def, call_def', [
('lam... | [UselessLambdaViolation]) | added | 609d7875b63f079f067130934ca0a5c905fadd166d734837352ca5c90eb512fd | assert_*|test_incorrect_lambda_definition|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( UselessLambdaViolation, ) from wemake_python_styleguide.visitors.ast.functions import ( UselessLambdaDefinitionVisitor, ) template = '{0}: {1}' @pytest.mark.parametrize('lambd... | null | null | null |
wemake-services/wemake-python-styleguide | train | 200 | eb727926e3eea2429fefe98b6315aabd78990117 | train | tests/test_regressions/test_regression112.py | train | wemake-services/wemake-python-styleguide:tests/test_regressions/test_regression112.py | 54 | 4 | assert | test_regression112 | # -*- coding: utf-8 -*-
import ast
from pyflakes.checker import Checker as PyFlakesChecker
from wemake_python_styleguide.checker import Checker
code_that_brakes = '''
def current_session(
telegram_id: int,
for_update: bool = True,
) -> TelegramSession:
"""
Was triggering `AttributeError`.
See: ... | flakes.root | modified | d9480cebbc4cecb9b17063bbe24033ea0e7fe52d894b187e0d71bd5188a4269d | assert|test_regression112|# -*- coding: utf-8 -*- import ast from pyflakes.checker import Checker as PyFlakesChecker from wemake_python_styleguide.checker import Checker code_that_brakes = ''' def current_session( telegram_id: int, for_update: bool = True, ) -> TelegramSession: """ Was triggering `AttributeError`. See:... | flakes.root | 51 | 4 |
wemake-services/wemake-python-styleguide | train | 200 | eb727926e3eea2429fefe98b6315aabd78990117 | train | tests/test_visitors/test_ast/test_builtins/test_magic_numbers.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_builtins/test_magic_numbers.py | 186 | 4 | assert_* | test_magic_number_warning | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.constants import MAGIC_NUMBERS_WHITELIST
from wemake_python_styleguide.violations.best_practices import (
MagicNumberViolation,
)
from wemake_python_styleguide.visitors.ast.builtins import MagicNumberVisitor
# Correct usages:
assignment = 'cons... | [MagicNumberViolation]) | added | d4dd5565fa030762d963a8877774b003df4437b08e5aa2334751f6aa7abd51a5 | assert_*|test_magic_number_warning|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.constants import MAGIC_NUMBERS_WHITELIST from wemake_python_styleguide.violations.best_practices import ( MagicNumberViolation, ) from wemake_python_styleguide.visitors.ast.builtins import MagicNumberVisitor # Correct... | null | null | null |
wemake-services/wemake-python-styleguide | train | 200 | eb727926e3eea2429fefe98b6315aabd78990117 | train | tests/test_visitors/test_ast/test_classes/test_class_attributes/test_shadow_attributes.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_classes/test_class_attributes/test_shadow_attributes.py | 117 | 4 | assert_* | test_incorrect_fields | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
ShadowedClassAttributeViolation,
)
from wemake_python_styleguide.visitors.ast.classes import ClassAttributeVisitor
# Can raise:
class_attribute = """
class ClassWithAttrs(object):
{0} = 0
def __init__... | [ShadowedClassAttributeViolation]) | added | c2065be1a18162aa506c4e8bb37b8daf43aa8d9caf67748b846bbed5a4b87336 | assert_*|test_incorrect_fields|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( ShadowedClassAttributeViolation, ) from wemake_python_styleguide.visitors.ast.classes import ClassAttributeVisitor # Can raise: class_attribute = """ class ClassWithAttrs(object): {0} = ... | null | null | null |
wemake-services/wemake-python-styleguide | train | 200 | eb727926e3eea2429fefe98b6315aabd78990117 | train | tests/test_visitors/test_ast/test_compares/test_simplifiable_ifs/test_simplifiable_if_node.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_compares/test_simplifiable_ifs/test_simplifiable_if_node.py | 128 | 4 | assert_* | test_simplifiable_node | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
SimplifiableIfViolation,
)
from wemake_python_styleguide.visitors.ast.compares import (
WrongConditionalVisitor,
)
# Correct:
simple_if_template = """
if some_value:
{0} = {1}
else:
{2} = {3}
"""
... | [SimplifiableIfViolation]) | added | d08f948f46a2893ce613cfc86459e5efc1adb23a29497ff8df9e212c0e5828ce | assert_*|test_simplifiable_node|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( SimplifiableIfViolation, ) from wemake_python_styleguide.visitors.ast.compares import ( WrongConditionalVisitor, ) # Correct: simple_if_template = """ if some_value: {0} = {1} else: {2}... | null | null | null |
wemake-services/wemake-python-styleguide | train | 200 | eb727926e3eea2429fefe98b6315aabd78990117 | train | tests/test_visitors/test_ast/test_modules/test_mutable_constants.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_modules/test_mutable_constants.py | 46 | 4 | assert_* | test_wrong_constant_type_used | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
MutableModuleConstantViolation,
)
from wemake_python_styleguide.visitors.ast.modules import (
ModuleConstantsVisitor,
)
module_constant = 'CONST = {0}'
module_typed_constant = 'CONST: int = {0}'
module_var... | [MutableModuleConstantViolation]) | added | 5a21040e5eb8378b180a0bf8033fb366892c92662007269f81fb62a321e3f697 | assert_*|test_wrong_constant_type_used|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( MutableModuleConstantViolation, ) from wemake_python_styleguide.visitors.ast.modules import ( ModuleConstantsVisitor, ) module_constant = 'CONST = {0}' module_typed_constant = 'C... | null | null | null |
wemake-services/wemake-python-styleguide | train | 200 | eb727926e3eea2429fefe98b6315aabd78990117 | train | tests/test_visitors/test_ast/test_naming/test_class_attributes.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_naming/test_class_attributes.py | 57 | 4 | assert_* | test_upper_case_class_attributes | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.naming import (
UpperCaseAttributeViolation,
)
from wemake_python_styleguide.visitors.ast.naming import WrongNameVisitor
static_attribute = """
class Test(object):
{0} = None
"""
static_typed_attribute = """
class Test(object):
... | non_snake_case_name) | added | 6f108c49bad1a64a4d7c7bf899cb28be3f760d36ec551c5c37be52e5356f86e7 | assert_*|test_upper_case_class_attributes|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.naming import ( UpperCaseAttributeViolation, ) from wemake_python_styleguide.visitors.ast.naming import WrongNameVisitor static_attribute = """ class Test(object): {0} = None """ static_typed_attribu... | null | null | null |
wemake-services/wemake-python-styleguide | train | 200 | eb727926e3eea2429fefe98b6315aabd78990117 | train | tests/test_visitors/test_ast/test_naming/test_module_metadata.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_naming/test_module_metadata.py | 51 | 4 | assert_* | test_wrong_metadata | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
WrongModuleMetadataViolation,
)
from wemake_python_styleguide.visitors.ast.naming import (
MODULE_METADATA_VARIABLES_BLACKLIST,
WrongModuleMetadataVisitor,
)
module_metadata = """
{0} = 'Nikita'
"""
mo... | [WrongModuleMetadataViolation]) | added | e79da42ea8af30d31917b570e3150ac4f2d4c27949040284b49bb07114d63fa3 | assert_*|test_wrong_metadata|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( WrongModuleMetadataViolation, ) from wemake_python_styleguide.visitors.ast.naming import ( MODULE_METADATA_VARIABLES_BLACKLIST, WrongModuleMetadataVisitor, ) module_metadata = """ {0} = 'N... | null | null | null |
wemake-services/wemake-python-styleguide | train | 200 | eb727926e3eea2429fefe98b6315aabd78990117 | train | tests/test_visitors/test_ast/test_naming/test_variable_self_reassignment.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_naming/test_variable_self_reassignment.py | 109 | 4 | assert_* | test_self_variable_reassignment | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
ReassigningVariableToItselfViolation,
)
from wemake_python_styleguide.visitors.ast.naming import (
WrongVariableAssignmentVisitor,
)
wrong_fragment = """
test_variable = 5
test_variable = test_variable
"""
... | [ReassigningVariableToItselfViolation]) | added | 70efbd79657bc3df1ff71c211d13e974de7eb61843c85da368dfa51adcadd09d | assert_*|test_self_variable_reassignment|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( ReassigningVariableToItselfViolation, ) from wemake_python_styleguide.visitors.ast.naming import ( WrongVariableAssignmentVisitor, ) wrong_fragment = """ test_variable = 5 test... | null | null | null |
wemake-services/wemake-python-styleguide | train | 201 | 043d8bfba9515eea3231e9c2c657b11819c9947d | train | tests/fixtures/noqa.py | train | wemake-services/wemake-python-styleguide:tests/fixtures/noqa.py | 198 | 0 | assert | # -*- coding: utf-8 -*-
"""
This file contains all possible violations.
It is used for e2e tests.
"""
from __future__ import print_function # noqa: Z422
import os.path # noqa: Z301
import sys as sys # noqa: Z113
from some import _protected # noqa: Z440
from .version import get_version # noqa: Z300
full_name... | octal_number | modified | cb8c642850a9a513d7b5c0fb63ab57a11decaa3e375df13665468654c0601758 | assert||# -*- coding: utf-8 -*- """ This file contains all possible violations. It is used for e2e tests. """ from __future__ import print_function # noqa: Z422 import os.path # noqa: Z301 import sys as sys # noqa: Z113 from some import _protected # noqa: Z440 from .version import get_version # noqa: Z300 full_name = u... | octal_number | 195 | 0 | |
wemake-services/wemake-python-styleguide | train | 201 | 043d8bfba9515eea3231e9c2c657b11819c9947d | train | tests/fixtures/noqa.py | train | wemake-services/wemake-python-styleguide:tests/fixtures/noqa.py | 209 | 0 | assert | # -*- coding: utf-8 -*-
"""
This file contains all possible violations.
It is used for e2e tests.
"""
from __future__ import print_function # noqa: Z422
import os.path # noqa: Z301
import sys as sys # noqa: Z113
from some import _protected # noqa: Z440
from .version import get_version # noqa: Z300
full_name... | hex_number | modified | 5ff59627c166839a677904a7765e8888ed85a7bfdad2e7bced959f426a2cd612 | assert||# -*- coding: utf-8 -*- """ This file contains all possible violations. It is used for e2e tests. """ from __future__ import print_function # noqa: Z422 import os.path # noqa: Z301 import sys as sys # noqa: Z113 from some import _protected # noqa: Z440 from .version import get_version # noqa: Z300 full_name = u... | hex_number | 206 | 0 | |
wemake-services/wemake-python-styleguide | train | 201 | 043d8bfba9515eea3231e9c2c657b11819c9947d | train | tests/test_visitors/test_ast/test_classes/test_class_attributes/test_shadow_attributes.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_classes/test_class_attributes/test_shadow_attributes.py | 117 | 4 | assert_* | test_incorrect_fields | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
ShadowedClassAttributeViolation,
)
from wemake_python_styleguide.visitors.ast.classes import ClassAttributeVisitor
# Can raise:
class_attribute = """
class ClassWithAttrs(object):
{0} = 0
def __init__... | [ShadowedClassAttributeViolation]) | added | c598ba91b114386b9af6b7f9f58748c02383f2f6e9b872f4368b5769e99506df | assert_*|test_incorrect_fields|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( ShadowedClassAttributeViolation, ) from wemake_python_styleguide.visitors.ast.classes import ClassAttributeVisitor # Can raise: class_attribute = """ class ClassWithAttrs(object): {0} = ... | null | null | null |
wemake-services/wemake-python-styleguide | train | 201 | 043d8bfba9515eea3231e9c2c657b11819c9947d | train | tests/test_visitors/test_ast/test_classes/test_class_attributes/test_shadow_attributes.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_classes/test_class_attributes/test_shadow_attributes.py | 118 | 4 | assert_* | test_incorrect_fields | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
ShadowedClassAttributeViolation,
)
from wemake_python_styleguide.visitors.ast.classes import ClassAttributeVisitor
# Can raise:
class_attribute = """
class ClassWithAttrs(object):
{0} = 0
def __init__... | field_name) | added | d75bacb7d87d6eb14f3e6d3dde6df785fe8fd8950ca37acdb5053940956e7f60 | assert_*|test_incorrect_fields|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( ShadowedClassAttributeViolation, ) from wemake_python_styleguide.visitors.ast.classes import ClassAttributeVisitor # Can raise: class_attribute = """ class ClassWithAttrs(object): {0} = ... | null | null | null |
wemake-services/wemake-python-styleguide | train | 201 | 043d8bfba9515eea3231e9c2c657b11819c9947d | train | tests/test_visitors/test_ast/test_complexity/test_counts/test_compare_complexity.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_complexity/test_counts/test_compare_complexity.py | 82 | 4 | assert_* | test_module_compare_counts_violation | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.complexity import (
TooLongCompareViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.counts import (
ConditionsVisitor,
)
# Correct:
empty_module = ''
one_compare = 'x > 1'
two_compare = 'x < y() >= 2'
one_equals... | [TooLongCompareViolation]) | added | 5448e91aa8dee7eb2b302ba2e7f2197e943d6b1ec2fafb8d5a21de8b6f5ea25c | assert_*|test_module_compare_counts_violation|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.complexity import ( TooLongCompareViolation, ) from wemake_python_styleguide.visitors.ast.complexity.counts import ( ConditionsVisitor, ) # Correct: empty_module = '' one_compare = 'x > 1' two_co... | null | null | null |
wemake-services/wemake-python-styleguide | train | 202 | d447c86cc0db1d2cb3844ece031aa6b6a103c3d7 | train | tests/fixtures/external_plugins.py | train | wemake-services/wemake-python-styleguide:tests/fixtures/external_plugins.py | 21 | 0 | assert | #!/usr/bin/env perl
from sys import *
import sys
from typing import List, Union, Dict
int = 12
++int
extra_parens = list((node for node in 'abc'))
some_tuple = (1, 2, )
breaking_pycodestyle=3
# commented: str = 'comment'
def camelCase(): ...
'{}'.format(1)
""
'%s' % 'test'
assert | True | modified | 5f745a880d902ecd10f570ad0ebd662c409ed2026b5ec938ff0e2bc63c9f9e5e | assert||#!/usr/bin/env perl from sys import * import sys from typing import List, Union, Dict int = 12 ++int extra_parens = list((node for node in 'abc')) some_tuple = (1, 2, ) breaking_pycodestyle=3 # commented: str = 'comment' def camelCase(): ... '{}'.format(1) "" '%s' % 'test' assert | True | 20 | 0 | |
wemake-services/wemake-python-styleguide | train | 203 | 5f554cc3d6ad0984fef9055bf9dea559cfe8bae1 | train | tests/test_visitors/test_ast/test_complexity/test_counts/test_compare_complexity.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_complexity/test_counts/test_compare_complexity.py | 86 | 4 | assert_* | test_module_compare_counts_violation | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.complexity import (
TooLongCompareViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.counts import (
ConditionsVisitor,
)
# Correct:
empty_module = ''
one_compare = 'x > 1'
two_compare = 'x < y() >= 2'
one_equals... | [TooLongCompareViolation]) | added | 13007b4b8a830bfc431b7f028600155616bb569bd5eb9b6a442be5735a51f7c8 | assert_*|test_module_compare_counts_violation|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.complexity import ( TooLongCompareViolation, ) from wemake_python_styleguide.visitors.ast.complexity.counts import ( ConditionsVisitor, ) # Correct: empty_module = '' one_compare = 'x > 1' two_co... | null | null | null |
wemake-services/wemake-python-styleguide | train | 204 | c961372993f306aa4906a821f10180359c8da337 | train | tests/test_visitors/test_ast/test_compares/test_nested_ternary.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_compares/test_nested_ternary.py | 139 | 4 | assert_* | test_nested_ternary | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
IncorrectlyNestedTernaryViolation,
)
from wemake_python_styleguide.visitors.ast.compares import (
WrongConditionalVisitor,
)
wrong_compare1 = 'x > (a if b else c)'
wrong_compare2 = '(a if b else c) > x'
wro... | [IncorrectlyNestedTernaryViolation]) | added | 225dc163a300eb11d4e5cb25f30e79726205e4f1e1c83ec754d8b75f76e6178b | assert_*|test_nested_ternary|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( IncorrectlyNestedTernaryViolation, ) from wemake_python_styleguide.visitors.ast.compares import ( WrongConditionalVisitor, ) wrong_compare1 = 'x > (a if b else c)' wrong_compare2 = '(a if ... | null | null | null |
wemake-services/wemake-python-styleguide | train | 205 | 24a7659dcfa91759e8dadd9e6325ca0dab9d4f80 | train | tests/test_visitors/test_ast/test_conditions/test_useless_len_call.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_conditions/test_useless_len_call.py | 53 | 4 | assert_* | test_useless_len_call | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
UselessLenCompareViolation,
)
from wemake_python_styleguide.visitors.ast.conditions import IfStatementVisitor
correct_call1 = 'print(len([]))'
correct_call2 = 'assert len([]) == len([])'
correct_call3 = 'if sum... | [UselessLenCompareViolation]) | added | 1bdc1556ee7c2a79268bdef11bfc62b7208c0a74ba7d7c4741d56df3daa2ae14 | assert_*|test_useless_len_call|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( UselessLenCompareViolation, ) from wemake_python_styleguide.visitors.ast.conditions import IfStatementVisitor correct_call1 = 'print(len([]))' correct_call2 = 'assert len([]) == len([])'... | null | null | null |
wemake-services/wemake-python-styleguide | train | 206 | b99e6951e07ac317d96cb2e7bebcec85291b665b | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 31 | 8 | assert | # -*- coding: utf-8 -*-
from typing import Sequence
import pytest
from wemake_python_styleguide.violations.base import (
ASTViolation,
TokenizeViolation,
)
from wemake_python_styleguide.visitors.base import BaseVisitor
@pytest.fixture(scope='session')
def assert_errors():
"""Helper function to assert v... | len(real_errors) | added | 6a7013ea9f9d68690679c66f73af609e70e8606bdcb0db33dfb7c96ff977a967 | assert||# -*- coding: utf-8 -*- from typing import Sequence import pytest from wemake_python_styleguide.violations.base import ( ASTViolation, TokenizeViolation, ) from wemake_python_styleguide.visitors.base import BaseVisitor @pytest.fixture(scope='session') def assert_errors(): """Helper function to assert visitor vi... | null | null | null | |
wemake-services/wemake-python-styleguide | train | 206 | b99e6951e07ac317d96cb2e7bebcec85291b665b | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 34 | 12 | assert | # -*- coding: utf-8 -*-
from typing import Sequence
import pytest
from wemake_python_styleguide.violations.base import (
ASTViolation,
TokenizeViolation,
)
from wemake_python_styleguide.visitors.base import BaseVisitor
@pytest.fixture(scope='session')
def assert_errors():
"""Helper function to assert v... | errors[index].code | added | 2c4771f71fc8ef9d318983f73463651c410a4ee28c62e244764434b465e7d637 | assert||# -*- coding: utf-8 -*- from typing import Sequence import pytest from wemake_python_styleguide.violations.base import ( ASTViolation, TokenizeViolation, ) from wemake_python_styleguide.visitors.base import BaseVisitor @pytest.fixture(scope='session') def assert_errors(): """Helper function to assert visitor vi... | null | null | null | |
wemake-services/wemake-python-styleguide | train | 206 | b99e6951e07ac317d96cb2e7bebcec85291b665b | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 36 | 16 | assert | # -*- coding: utf-8 -*-
from typing import Sequence
import pytest
from wemake_python_styleguide.violations.base import (
ASTViolation,
TokenizeViolation,
)
from wemake_python_styleguide.visitors.base import BaseVisitor
@pytest.fixture(scope='session')
def assert_errors():
"""Helper function to assert v... | None | added | 24193bb1d845124f6eb31694b62d6ddb8547000e78458fdea724f239158f0779 | assert||# -*- coding: utf-8 -*- from typing import Sequence import pytest from wemake_python_styleguide.violations.base import ( ASTViolation, TokenizeViolation, ) from wemake_python_styleguide.visitors.base import BaseVisitor @pytest.fixture(scope='session') def assert_errors(): """Helper function to assert visitor vi... | null | null | null | |
wemake-services/wemake-python-styleguide | train | 206 | b99e6951e07ac317d96cb2e7bebcec85291b665b | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 51 | 8 | assert | # -*- coding: utf-8 -*-
from typing import Sequence
import pytest
from wemake_python_styleguide.violations.base import (
ASTViolation,
TokenizeViolation,
)
from wemake_python_styleguide.visitors.base import BaseVisitor
@pytest.fixture(scope='session')
def assert_errors():
"""Helper function to assert v... | violation.error_template | added | 45fe477322519e79a23b401fa53458185df7c2bffa3a4fd82ed27dac33718f26 | assert||# -*- coding: utf-8 -*- from typing import Sequence import pytest from wemake_python_styleguide.violations.base import ( ASTViolation, TokenizeViolation, ) from wemake_python_styleguide.visitors.base import BaseVisitor @pytest.fixture(scope='session') def assert_errors(): """Helper function to assert visitor vi... | null | null | null | |
wemake-services/wemake-python-styleguide | train | 206 | b99e6951e07ac317d96cb2e7bebcec85291b665b | train | tests/test_visitors/test_ast/test_compares/test_conditionals.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_compares/test_conditionals.py | 91 | 4 | assert_* | test_useless | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.consistency import (
ConstantConditionViolation,
)
from wemake_python_styleguide.visitors.ast.compares import (
WrongConditionalVisitor,
)
create_variable = """
variable = 1
{0}
"""
if_statement = 'if {0}: ...'
ternary = 'ternary... | [ConstantConditionViolation]) | modified | 2f0a2922770d4b989feea94c07ea06a761a35612d6438127400f0389c5749b0f | assert_*|test_useless|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.consistency import ( ConstantConditionViolation, ) from wemake_python_styleguide.visitors.ast.compares import ( WrongConditionalVisitor, ) create_variable = """ variable = 1 {0} """ if_statement = 'if {0}: ...' ternary ... | [WrongConditionalViolation]) | 91 | 4 |
wemake-services/wemake-python-styleguide | train | 206 | b99e6951e07ac317d96cb2e7bebcec85291b665b | train | tests/test_visitors/test_ast/test_compares/test_nested_ternary.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_compares/test_nested_ternary.py | 143 | 4 | assert_* | test_nested_ternary | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
IncorrectlyNestedTernaryViolation,
)
from wemake_python_styleguide.visitors.ast.compares import (
WrongConditionalVisitor,
)
wrong_compare1 = 'x > (a if b else c)'
wrong_compare2 = '(a if b else c) > x'
wro... | [IncorrectlyNestedTernaryViolation]) | added | 848396dd693eb3142bc016306c1356b2b1879335bca3c77cb4a7c1d08a7374be | assert_*|test_nested_ternary|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( IncorrectlyNestedTernaryViolation, ) from wemake_python_styleguide.visitors.ast.compares import ( WrongConditionalVisitor, ) wrong_compare1 = 'x > (a if b else c)' wrong_compare2 = '(a if ... | null | null | null |
wemake-services/wemake-python-styleguide | train | 206 | b99e6951e07ac317d96cb2e7bebcec85291b665b | train | tests/test_visitors/test_ast/test_conditions/test_implicit_ternary.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_conditions/test_implicit_ternary.py | 55 | 4 | assert_* | test_implicit_ternary | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.consistency import (
ImplicitTernaryViolation,
)
from wemake_python_styleguide.visitors.ast.conditions import (
BooleanConditionVisitor,
)
# Correct:
not_ternary1 = 'cond() and {0} and {1}'
not_ternary2 = 'cond() or {0} and {1}'
... | [ImplicitTernaryViolation]) | added | 55a1f6b7c080c052e84979df75d6f6ec27e99e0f1acabfb2631c5db69c9fc0d7 | assert_*|test_implicit_ternary|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.consistency import ( ImplicitTernaryViolation, ) from wemake_python_styleguide.visitors.ast.conditions import ( BooleanConditionVisitor, ) # Correct: not_ternary1 = 'cond() and {0} and {1}' not_ternary2 = 'cond... | null | null | null |
wemake-services/wemake-python-styleguide | train | 206 | b99e6951e07ac317d96cb2e7bebcec85291b665b | train | tests/test_visitors/test_ast/test_conditions/test_same_element.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_conditions/test_same_element.py | 70 | 4 | assert_* | test_duplicate_element | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
SameElementsInConditionViolation,
)
from wemake_python_styleguide.violations.consistency import (
ImplicitTernaryViolation,
)
from wemake_python_styleguide.visitors.ast.conditions import (
BooleanConditi... | ImplicitTernaryViolation) | modified | b7d1a76aa5b914104bc14b455f05ecb5cfed7e0bb36845138ba0aa62d26bfe16 | assert_*|test_duplicate_element|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( SameElementsInConditionViolation, ) from wemake_python_styleguide.violations.consistency import ( ImplicitTernaryViolation, ) from wemake_python_styleguide.visitors.ast.conditions impor... | [SameElementsInConditionViolation]) | 67 | 4 |
wemake-services/wemake-python-styleguide | train | 207 | 294952e0e022ad3ec442190b9c058b71e21f2437 | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 24 | 12 | assert | # -*- coding: utf-8 -*-
from typing import Sequence
import pytest
from wemake_python_styleguide.violations.base import (
ASTViolation,
TokenizeViolation,
)
from wemake_python_styleguide.visitors.base import BaseVisitor
@pytest.fixture(scope='session')
def assert_errors():
"""Helper function to assert v... | errors[index].code | added | 1c18941fc2ecf97f3c08a306286cc295aeb63e67a70908851be7eb3dbf6cf6ae | assert||# -*- coding: utf-8 -*- from typing import Sequence import pytest from wemake_python_styleguide.violations.base import ( ASTViolation, TokenizeViolation, ) from wemake_python_styleguide.visitors.base import BaseVisitor @pytest.fixture(scope='session') def assert_errors(): """Helper function to assert visitor vi... | null | null | null | |
wemake-services/wemake-python-styleguide | train | 207 | 294952e0e022ad3ec442190b9c058b71e21f2437 | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 41 | 8 | assert | # -*- coding: utf-8 -*-
from typing import Sequence
import pytest
from wemake_python_styleguide.violations.base import (
ASTViolation,
TokenizeViolation,
)
from wemake_python_styleguide.visitors.base import BaseVisitor
@pytest.fixture(scope='session')
def assert_errors():
"""Helper function to assert v... | violation.error_template | added | f8900302e1f89e188e23830b928f958d7b4735d5eeefab047e8cabf5416d8fa0 | assert||# -*- coding: utf-8 -*- from typing import Sequence import pytest from wemake_python_styleguide.violations.base import ( ASTViolation, TokenizeViolation, ) from wemake_python_styleguide.visitors.base import BaseVisitor @pytest.fixture(scope='session') def assert_errors(): """Helper function to assert visitor vi... | null | null | null | |
wemake-services/wemake-python-styleguide | train | 207 | 294952e0e022ad3ec442190b9c058b71e21f2437 | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 48 | 8 | assert | # -*- coding: utf-8 -*-
from typing import Sequence
import pytest
from wemake_python_styleguide.violations.base import (
ASTViolation,
TokenizeViolation,
)
from wemake_python_styleguide.visitors.base import BaseVisitor
@pytest.fixture(scope='session')
def assert_errors():
"""Helper function to assert v... | violation.message() | added | 98135c9afb528458e66cd5899b5add2c356930e8181efeeb8800c8d69046e4fe | assert||# -*- coding: utf-8 -*- from typing import Sequence import pytest from wemake_python_styleguide.violations.base import ( ASTViolation, TokenizeViolation, ) from wemake_python_styleguide.visitors.base import BaseVisitor @pytest.fixture(scope='session') def assert_errors(): """Helper function to assert visitor vi... | null | null | null | |
wemake-services/wemake-python-styleguide | train | 207 | 294952e0e022ad3ec442190b9c058b71e21f2437 | train | tests/test_visitors/test_ast/test_conditions/test_implicit_complex_compare.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_conditions/test_implicit_complex_compare.py | 93 | 4 | assert_* | test_implicit_complex_compare | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.consistency import (
ImplicitComplexCompareViolation,
)
from wemake_python_styleguide.visitors.ast.conditions import (
BooleanConditionVisitor,
)
# Wrong:
less_or_less = '{0} < {1} or {2} < {3}'
less_or_more = '{0} < {1} or {2} >... | [ImplicitComplexCompareViolation]) | added | 5bcb6e3339dce0179f74018560f942f9291ce4f92aafdebf455e68b671c812a7 | assert_*|test_implicit_complex_compare|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.consistency import ( ImplicitComplexCompareViolation, ) from wemake_python_styleguide.visitors.ast.conditions import ( BooleanConditionVisitor, ) # Wrong: less_or_less = '{0} < {1} or {2} < {3}' less_or... | null | null | null |
wemake-services/wemake-python-styleguide | train | 207 | 294952e0e022ad3ec442190b9c058b71e21f2437 | train | tests/test_visitors/test_ast/test_conditions/test_implicit_complex_compare.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_conditions/test_implicit_complex_compare.py | 132 | 4 | assert_* | test_implicit_complex_compare_reversed | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.consistency import (
ImplicitComplexCompareViolation,
)
from wemake_python_styleguide.visitors.ast.conditions import (
BooleanConditionVisitor,
)
# Wrong:
less_or_less = '{0} < {1} or {2} < {3}'
less_or_more = '{0} < {1} or {2} >... | [ImplicitComplexCompareViolation]) | added | 53e8becfcbefb70d0a2348f9c85df458358ace1babc3113efcc43c6e9cdcff65 | assert_*|test_implicit_complex_compare_reversed|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.consistency import ( ImplicitComplexCompareViolation, ) from wemake_python_styleguide.visitors.ast.conditions import ( BooleanConditionVisitor, ) # Wrong: less_or_less = '{0} < {1} or {2} < {3}... | null | null | null |
wemake-services/wemake-python-styleguide | train | 207 | 294952e0e022ad3ec442190b9c058b71e21f2437 | train | tests/test_visitors/test_ast/test_conditions/test_same_element.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_conditions/test_same_element.py | 68 | 4 | assert_* | test_duplicate_element | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
SameElementsInConditionViolation,
)
from wemake_python_styleguide.violations.consistency import (
ImplicitTernaryViolation,
)
from wemake_python_styleguide.visitors.ast.conditions import (
BooleanConditi... | [SameElementsInConditionViolation]) | modified | 40e1ed3dd25fdbffc5395c6dae992a0df409858f1780719b25ed0f8dfb75c263 | assert_*|test_duplicate_element|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( SameElementsInConditionViolation, ) from wemake_python_styleguide.violations.consistency import ( ImplicitTernaryViolation, ) from wemake_python_styleguide.visitors.ast.conditions impor... | ImplicitTernaryViolation) | 70 | 4 |
wemake-services/wemake-python-styleguide | train | 207 | 294952e0e022ad3ec442190b9c058b71e21f2437 | train | tests/test_visitors/test_ast/test_conditions/test_same_element.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_conditions/test_same_element.py | 87 | 4 | assert_* | test_duplicate_element_and_ternary | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
SameElementsInConditionViolation,
)
from wemake_python_styleguide.violations.consistency import (
ImplicitTernaryViolation,
)
from wemake_python_styleguide.visitors.ast.conditions import (
BooleanConditi... | [ ImplicitTernaryViolation, SameElementsInConditionViolation, ]) | added | 9d5b14e01d85d232284c7e4d0e8ffed1b48df77606ac407abaa7d514101d9603 | assert_*|test_duplicate_element_and_ternary|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( SameElementsInConditionViolation, ) from wemake_python_styleguide.violations.consistency import ( ImplicitTernaryViolation, ) from wemake_python_styleguide.visitors.ast.cond... | null | null | null |
wemake-services/wemake-python-styleguide | train | 207 | 294952e0e022ad3ec442190b9c058b71e21f2437 | train | tests/test_visitors/test_ast/test_functions/test_complex_default_values.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_functions/test_complex_default_values.py | 37 | 4 | assert_* | test_wrong_function_defaults | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
ComplexDefaultValueViolation,
)
from wemake_python_styleguide.visitors.ast.functions import (
FunctionDefinitionVisitor,
)
function_with_defaults = """
def function(self, with_default={0}):
...
"""
@p... | [ComplexDefaultValueViolation]) | modified | 936644e650413ac723c81c7539e958ef56f2b08165574c18585cba2ff8920da5 | assert_*|test_wrong_function_defaults|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( ComplexDefaultValueViolation, ) from wemake_python_styleguide.visitors.ast.functions import ( FunctionDefinitionVisitor, ) function_with_defaults = """ def function(self, with_def... | [ComplexDefaultValuesViolation]) | 37 | 4 |
wemake-services/wemake-python-styleguide | train | 208 | 33bf8c7560886da2e81b99cd7b7ea3df66a91b76 | train | tests/fixtures/noqa.py | train | wemake-services/wemake-python-styleguide:tests/fixtures/noqa.py | 198 | 0 | assert | # -*- coding: utf-8 -*-
"""
This file contains all possible violations.
It is used for e2e tests.
"""
from __future__ import print_function # noqa: Z422
import os.path # noqa: Z301
import sys as sys # noqa: Z113
from some import _protected # noqa: Z440
from .version import get_version # noqa: Z300
full_name... | octal_number | modified | 4a7a8d3a4e64def4f76565013639ca7b8cac63211cd7be0583a0b5522a7daf7d | assert||# -*- coding: utf-8 -*- """ This file contains all possible violations. It is used for e2e tests. """ from __future__ import print_function # noqa: Z422 import os.path # noqa: Z301 import sys as sys # noqa: Z113 from some import _protected # noqa: Z440 from .version import get_version # noqa: Z300 full_name = u... | octal_number | 198 | 0 | |
wemake-services/wemake-python-styleguide | train | 208 | 33bf8c7560886da2e81b99cd7b7ea3df66a91b76 | train | tests/fixtures/noqa.py | train | wemake-services/wemake-python-styleguide:tests/fixtures/noqa.py | 209 | 0 | assert | # -*- coding: utf-8 -*-
"""
This file contains all possible violations.
It is used for e2e tests.
"""
from __future__ import print_function # noqa: Z422
import os.path # noqa: Z301
import sys as sys # noqa: Z113
from some import _protected # noqa: Z440
from .version import get_version # noqa: Z300
full_name... | hex_number | modified | c56590358cf63aa5768eca4f709987a644f1901726826d5e3fd25da2a53b61b9 | assert||# -*- coding: utf-8 -*- """ This file contains all possible violations. It is used for e2e tests. """ from __future__ import print_function # noqa: Z422 import os.path # noqa: Z301 import sys as sys # noqa: Z113 from some import _protected # noqa: Z440 from .version import get_version # noqa: Z300 full_name = u... | hex_number | 209 | 0 | |
wemake-services/wemake-python-styleguide | train | 208 | 33bf8c7560886da2e81b99cd7b7ea3df66a91b76 | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 31 | 8 | assert | # -*- coding: utf-8 -*-
from typing import Sequence
import pytest
from wemake_python_styleguide.violations.base import (
ASTViolation,
TokenizeViolation,
)
from wemake_python_styleguide.visitors.base import BaseVisitor
@pytest.fixture(scope='session')
def assert_errors():
"""Helper function to assert v... | len(real_errors) | added | a0ec4b698142fd88aa3451852118732a694a0acd1864bd20cea2163cdb85d6cd | assert||# -*- coding: utf-8 -*- from typing import Sequence import pytest from wemake_python_styleguide.violations.base import ( ASTViolation, TokenizeViolation, ) from wemake_python_styleguide.visitors.base import BaseVisitor @pytest.fixture(scope='session') def assert_errors(): """Helper function to assert visitor vi... | null | null | null | |
wemake-services/wemake-python-styleguide | train | 208 | 33bf8c7560886da2e81b99cd7b7ea3df66a91b76 | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 52 | 8 | assert | # -*- coding: utf-8 -*-
from typing import Sequence
import pytest
from wemake_python_styleguide.violations.base import (
ASTViolation,
TokenizeViolation,
)
from wemake_python_styleguide.visitors.base import BaseVisitor
@pytest.fixture(scope='session')
def assert_errors():
"""Helper function to assert v... | violation.error_template.endswith(error_format) | added | 915380191c60446f2dad612e02d64c6a3cd582ca33812f30da9d2daff6fc581a | assert||# -*- coding: utf-8 -*- from typing import Sequence import pytest from wemake_python_styleguide.violations.base import ( ASTViolation, TokenizeViolation, ) from wemake_python_styleguide.visitors.base import BaseVisitor @pytest.fixture(scope='session') def assert_errors(): """Helper function to assert visitor vi... | null | null | null | |
wemake-services/wemake-python-styleguide | train | 208 | 33bf8c7560886da2e81b99cd7b7ea3df66a91b76 | train | tests/test_visitors/test_ast/test_compares/test_literal.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_compares/test_literal.py | 80 | 4 | assert_* | test_literal_special1 | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.consistency import (
ConstantCompareViolation,
ReversedComplexCompareViolation,
)
from wemake_python_styleguide.visitors.ast.compares import CompareSanityVisitor
if_with_chained_compares1 = 'if 0 < {0} < {1}: ...'
if_with_chained_... | [ConstantCompareViolation]) | modified | 067687db1965ce221ffd2a2f81c5276975bc4a0331ae19c24ef6e48f94f859f3 | assert_*|test_literal_special1|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.consistency import ( ConstantCompareViolation, ReversedComplexCompareViolation, ) from wemake_python_styleguide.visitors.ast.compares import CompareSanityVisitor if_with_chained_compares1 = 'if 0 < {0} < {1}: .... | [ConstantCompareViolation]) | 79 | 4 |
wemake-services/wemake-python-styleguide | train | 208 | 33bf8c7560886da2e81b99cd7b7ea3df66a91b76 | train | tests/test_visitors/test_ast/test_compares/test_literal.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_compares/test_literal.py | 104 | 4 | assert_* | test_literal_special2 | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.consistency import (
ConstantCompareViolation,
ReversedComplexCompareViolation,
)
from wemake_python_styleguide.visitors.ast.compares import CompareSanityVisitor
if_with_chained_compares1 = 'if 0 < {0} < {1}: ...'
if_with_chained_... | ReversedComplexCompareViolation) | modified | d1b958a69ebfec736499fae2acea8c6c96825b43eb0a09f9e3c3a917fe23dcc5 | assert_*|test_literal_special2|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.consistency import ( ConstantCompareViolation, ReversedComplexCompareViolation, ) from wemake_python_styleguide.visitors.ast.compares import CompareSanityVisitor if_with_chained_compares1 = 'if 0 < {0} < {1}: .... | [ConstantCompareViolation]) | 103 | 4 |
wemake-services/wemake-python-styleguide | train | 208 | 33bf8c7560886da2e81b99cd7b7ea3df66a91b76 | train | tests/test_visitors/test_ast/test_compares/test_reversed_complex_compare.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_compares/test_reversed_complex_compare.py | 27 | 4 | assert_* | test_reversed_complex_compare | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.consistency import (
ReversedComplexCompareViolation,
)
from wemake_python_styleguide.visitors.ast.compares import CompareSanityVisitor
@pytest.mark.parametrize('code', [
'x > y >= z',
'x > y > z',
])
def test_reversed_comple... | [ReversedComplexCompareViolation]) | added | 6a09bda3fc431e409f64ce2def9aad9ccdf49a9e70f4c3b888a611874e285c1c | assert_*|test_reversed_complex_compare|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.consistency import ( ReversedComplexCompareViolation, ) from wemake_python_styleguide.visitors.ast.compares import CompareSanityVisitor @pytest.mark.parametrize('code', [ 'x > y >= z', 'x > y > z', ]) d... | null | null | null |
wemake-services/wemake-python-styleguide | train | 208 | 33bf8c7560886da2e81b99cd7b7ea3df66a91b76 | train | tests/test_visitors/test_ast/test_compares/test_unpythonic/test_useless_len.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_compares/test_unpythonic/test_useless_len.py | 39 | 4 | assert_* | test_useless_len_call | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
UselessLenCompareViolation,
)
from wemake_python_styleguide.visitors.ast.compares import CompareSanityVisitor
@pytest.mark.parametrize('code', [
'len(some) > 0',
'len(some) >= 0',
'len(some) != 0',... | [UselessLenCompareViolation]) | modified | f0e807a17bcca72e1b75b775842251f1cfbafcc64e0a1da2a183497402d38386 | assert_*|test_useless_len_call|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( UselessLenCompareViolation, ) from wemake_python_styleguide.visitors.ast.compares import CompareSanityVisitor @pytest.mark.parametrize('code', [ 'len(some) > 0', 'len(some) >= 0', 'len(s... | [UselessLenCompareViolation]) | 38 | 4 |
wemake-services/wemake-python-styleguide | train | 209 | 96d7b43a120eb92d11635701dabebc62feca15bc | train | tests/test_visitors/test_ast/test_loops/test_loops/test_iter_type.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_loops/test_loops/test_iter_type.py | 42 | 4 | assert_* | test_iter_incorrect_type | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.consistency import (
IncorectLoopIterTypeViolation,
)
from wemake_python_styleguide.visitors.ast.loops import (
WrongLoopDefinitionVisitor,
)
for_loop_template = """
def function():
for index in {0}:
...
"""
@pytest.... | [IncorectLoopIterTypeViolation]) | added | 6af467507b25223f88e29b43089421bf8144a91cd1c87067dd2716cdcacbceec | assert_*|test_iter_incorrect_type|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.consistency import ( IncorectLoopIterTypeViolation, ) from wemake_python_styleguide.visitors.ast.loops import ( WrongLoopDefinitionVisitor, ) for_loop_template = """ def function(): for index in {0}: ... """... | null | null | null |
wemake-services/wemake-python-styleguide | train | 210 | fe49e4f86642871e318f21f258f39a2d4186da77 | train | tests/test_visitors/test_ast/test_compares/test_in_type_check.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_compares/test_in_type_check.py | 42 | 4 | assert_* | test_compare_with_wrong_type | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
WrongInCompareTypeViolation,
)
from wemake_python_styleguide.visitors.ast.compares import CompareSanityVisitor
in_template = 'some in {0}'
not_in_template = 'some not in {0}'
@pytest.mark.parametrize('code', ... | [WrongInCompareTypeViolation]) | added | a47f322b54b1e3d8b423424341410be3f17f36e646249b544fa87d1a175d2f73 | assert_*|test_compare_with_wrong_type|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( WrongInCompareTypeViolation, ) from wemake_python_styleguide.visitors.ast.compares import CompareSanityVisitor in_template = 'some in {0}' not_in_template = 'some not in {0}' @pyt... | null | null | null |
wemake-services/wemake-python-styleguide | train | 210 | fe49e4f86642871e318f21f258f39a2d4186da77 | train | tests/test_visitors/test_ast/test_compares/test_multiple_in.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_compares/test_multiple_in.py | 74 | 4 | assert_* | test_compare_with_multiple_in | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
HeterogenousCompareViolation,
)
from wemake_python_styleguide.violations.consistency import (
MultipleInCompareViolation,
)
from wemake_python_styleguide.visitors.ast.compares import CompareSanityVisitor
if... | [MultipleInCompareViolation]) | modified | caee999ae02149f743e519df17301733680ccc654e824ee63bf344c297a87270 | assert_*|test_compare_with_multiple_in|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( HeterogenousCompareViolation, ) from wemake_python_styleguide.violations.consistency import ( MultipleInCompareViolation, ) from wemake_python_styleguide.visitors.ast.compares im... | [MultipleInCompareViolation]) | 74 | 4 |
wemake-services/wemake-python-styleguide | train | 210 | fe49e4f86642871e318f21f258f39a2d4186da77 | train | tests/test_visitors/test_ast/test_compares/test_multiple_in.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_compares/test_multiple_in.py | 88 | 4 | assert_* | test_compare_with_mixed_in | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
HeterogenousCompareViolation,
)
from wemake_python_styleguide.violations.consistency import (
MultipleInCompareViolation,
)
from wemake_python_styleguide.visitors.ast.compares import CompareSanityVisitor
if... | [ MultipleInCompareViolation, HeterogenousCompareViolation, ]) | modified | 08502611f9cf32f3e17c03d72ee9f1f7bbd56c4535c795ab03c92b1e2677b644 | assert_*|test_compare_with_mixed_in|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( HeterogenousCompareViolation, ) from wemake_python_styleguide.violations.consistency import ( MultipleInCompareViolation, ) from wemake_python_styleguide.visitors.ast.compares impor... | [ MultipleInCompareViolation, HeterogenousCompareViolation, ]) | 88 | 4 |
wemake-services/wemake-python-styleguide | train | 211 | c9bfe3a2b8ad40f68023a4e71a37bc4d42010ab8 | train | tests/test_visitors/test_ast/test_conditions/test_redundant_returnin_else.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_conditions/test_redundant_returnin_else.py | 87 | 4 | assert_* | test_else_that_can_be_removed_in_loop | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
UselessReturningElseViolation,
)
from wemake_python_styleguide.visitors.ast.conditions import IfStatementVisitor
function_level_condition = """
def function():
if some_condition:
{0}
else:
... | [UselessReturningElseViolation]) | modified | d14b79306fe7053ccc2b45bb59927b2100e7f36e8123009b54e4bf72bcde399c | assert_*|test_else_that_can_be_removed_in_loop|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( UselessReturningElseViolation, ) from wemake_python_styleguide.visitors.ast.conditions import IfStatementVisitor function_level_condition = """ def function(): if some_co... | [UselessReturningElseViolation]) | 86 | 4 |
wemake-services/wemake-python-styleguide | train | 211 | c9bfe3a2b8ad40f68023a4e71a37bc4d42010ab8 | train | tests/test_visitors/test_ast/test_conditions/test_redundant_returnin_else.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_conditions/test_redundant_returnin_else.py | 105 | 4 | assert_* | test_else_that_can_be_removed_in_module | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
UselessReturningElseViolation,
)
from wemake_python_styleguide.visitors.ast.conditions import IfStatementVisitor
function_level_condition = """
def function():
if some_condition:
{0}
else:
... | [UselessReturningElseViolation]) | modified | fbfe4a33c750196670157acab354fad40d93dd75be25587e0a65a67ffd00928f | assert_*|test_else_that_can_be_removed_in_module|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( UselessReturningElseViolation, ) from wemake_python_styleguide.visitors.ast.conditions import IfStatementVisitor function_level_condition = """ def function(): if some_... | [UselessReturningElseViolation]) | 104 | 4 |
wemake-services/wemake-python-styleguide | train | 211 | c9bfe3a2b8ad40f68023a4e71a37bc4d42010ab8 | train | tests/test_visitors/test_ast/test_conditions/test_unmerged_isinstance_calls.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_conditions/test_unmerged_isinstance_calls.py | 58 | 4 | assert_* | test_wrong_isinstance_conditions | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
UnmergedIsinstanceCallsViolation,
)
from wemake_python_styleguide.visitors.ast.conditions import (
BooleanConditionVisitor,
)
@pytest.mark.parametrize('code', [
'isinstance(some, int)',
'isinstance... | [UnmergedIsinstanceCallsViolation]) | added | 5b9006758140991e781d657bd86fbd719b2dbc7cfec3e40045ea85975ea2a6a8 | assert_*|test_wrong_isinstance_conditions|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( UnmergedIsinstanceCallsViolation, ) from wemake_python_styleguide.visitors.ast.conditions import ( BooleanConditionVisitor, ) @pytest.mark.parametrize('code', [ 'isinstance(so... | null | null | null |
wemake-services/wemake-python-styleguide | train | 211 | c9bfe3a2b8ad40f68023a4e71a37bc4d42010ab8 | train | tests/test_visitors/test_ast/test_functions/test_isinstance_types.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_functions/test_isinstance_types.py | 53 | 4 | assert_* | test_wrong_isinstance_tuple | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
WrongIsinstanceWithTupleViolation,
)
from wemake_python_styleguide.visitors.ast.functions import (
WrongFunctionCallVisitor,
)
isinstance_call = 'isinstance(some, {0})'
@pytest.mark.parametrize('code', [
... | [WrongIsinstanceWithTupleViolation]) | added | e2bd03cfffda1800ec315297ee2bc526f246360166ae136087d68a68b1987dab | assert_*|test_wrong_isinstance_tuple|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( WrongIsinstanceWithTupleViolation, ) from wemake_python_styleguide.visitors.ast.functions import ( WrongFunctionCallVisitor, ) isinstance_call = 'isinstance(some, {0})' @pytest.mar... | null | null | null |
wemake-services/wemake-python-styleguide | train | 212 | b65ef65be1d3cf3ffcacb05d24e314d70dd8b8a6 | train | tests/test_visitors/test_ast/test_conditions/test_implicit_complex_compare.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_conditions/test_implicit_complex_compare.py | 93 | 4 | assert_* | test_implicit_complex_compare | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.consistency import (
ImplicitComplexCompareViolation,
)
from wemake_python_styleguide.visitors.ast.conditions import (
ImplicitBoolPatternsVisitor,
)
# Wrong:
less_or_less = '{0} < {1} or {2} < {3}'
less_or_more = '{0} < {1} or {... | [ImplicitComplexCompareViolation]) | modified | 4d57fabe42a510b1fbba57637af1657efeb6d73c1540bf7399cd4b5b14f62283 | assert_*|test_implicit_complex_compare|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.consistency import ( ImplicitComplexCompareViolation, ) from wemake_python_styleguide.visitors.ast.conditions import ( ImplicitBoolPatternsVisitor, ) # Wrong: less_or_less = '{0} < {1} or {2} < {3}' les... | [ImplicitComplexCompareViolation]) | 93 | 4 |
wemake-services/wemake-python-styleguide | train | 212 | b65ef65be1d3cf3ffcacb05d24e314d70dd8b8a6 | train | tests/test_visitors/test_ast/test_conditions/test_implicit_complex_compare.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_conditions/test_implicit_complex_compare.py | 132 | 4 | assert_* | test_implicit_complex_compare_reversed | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.consistency import (
ImplicitComplexCompareViolation,
)
from wemake_python_styleguide.visitors.ast.conditions import (
ImplicitBoolPatternsVisitor,
)
# Wrong:
less_or_less = '{0} < {1} or {2} < {3}'
less_or_more = '{0} < {1} or {... | [ImplicitComplexCompareViolation]) | modified | 9ecfc4657a228a7704e21eb6b64eed7263c00f708e0c9a3b0c783ba21e24d98d | assert_*|test_implicit_complex_compare_reversed|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.consistency import ( ImplicitComplexCompareViolation, ) from wemake_python_styleguide.visitors.ast.conditions import ( ImplicitBoolPatternsVisitor, ) # Wrong: less_or_less = '{0} < {1} or {2} <... | [ImplicitComplexCompareViolation]) | 132 | 4 |
wemake-services/wemake-python-styleguide | train | 212 | b65ef65be1d3cf3ffcacb05d24e314d70dd8b8a6 | train | tests/test_visitors/test_ast/test_conditions/test_implicit_in.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_conditions/test_implicit_in.py | 104 | 4 | assert_* | test_wrong_patterns_in_values | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.consistency import (
ImplicitInConditionViolation,
)
from wemake_python_styleguide.visitors.ast.conditions import (
ImplicitBoolPatternsVisitor,
)
# Correct:
eq_and = '{0} == some1 and {1} == some2'
noteq_or = '{0} != some1 or {1... | [ImplicitInConditionViolation]) | added | 332a904a867c4ee3f5855eea941b9220efa059d6ae0585b08c7d3f045e40cbbb | assert_*|test_wrong_patterns_in_values|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.consistency import ( ImplicitInConditionViolation, ) from wemake_python_styleguide.visitors.ast.conditions import ( ImplicitBoolPatternsVisitor, ) # Correct: eq_and = '{0} == some1 and {1} == some2' not... | null | null | null |
wemake-services/wemake-python-styleguide | train | 212 | b65ef65be1d3cf3ffcacb05d24e314d70dd8b8a6 | train | tests/test_visitors/test_ast/test_conditions/test_implicit_ternary.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_conditions/test_implicit_ternary.py | 55 | 4 | assert_* | test_implicit_ternary | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.consistency import (
ImplicitTernaryViolation,
)
from wemake_python_styleguide.visitors.ast.conditions import (
ImplicitBoolPatternsVisitor,
)
# Correct:
not_ternary1 = 'cond() and {0} and {1}'
not_ternary2 = 'cond() or {0} and {... | [ImplicitTernaryViolation]) | modified | 8e6740666ddd8971f4aae14eb6a873253231e1bc224a860cde61b0b3ad43139e | assert_*|test_implicit_ternary|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.consistency import ( ImplicitTernaryViolation, ) from wemake_python_styleguide.visitors.ast.conditions import ( ImplicitBoolPatternsVisitor, ) # Correct: not_ternary1 = 'cond() and {0} and {1}' not_ternary2 = '... | [ImplicitTernaryViolation]) | 55 | 4 |
wemake-services/wemake-python-styleguide | train | 212 | b65ef65be1d3cf3ffcacb05d24e314d70dd8b8a6 | train | tests/test_visitors/test_ast/test_conditions/test_same_element.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_conditions/test_same_element.py | 65 | 4 | assert_* | test_duplicate_element | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
SameElementsInConditionViolation,
)
from wemake_python_styleguide.visitors.ast.conditions import (
BooleanConditionVisitor,
)
@pytest.mark.parametrize('code', [
'some or other',
'other and some',
... | [SameElementsInConditionViolation]) | modified | 525379a3c06ac2d7484da7ce07a2933f76d337525519cb3e41b45a181b519812 | assert_*|test_duplicate_element|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( SameElementsInConditionViolation, ) from wemake_python_styleguide.visitors.ast.conditions import ( BooleanConditionVisitor, ) @pytest.mark.parametrize('code', [ 'some or other', 'other ... | [SameElementsInConditionViolation]) | 68 | 4 |
wemake-services/wemake-python-styleguide | train | 212 | b65ef65be1d3cf3ffcacb05d24e314d70dd8b8a6 | train | tests/test_visitors/test_ast/test_conditions/test_same_element.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_conditions/test_same_element.py | 84 | 4 | assert_* | test_duplicate_element_and_ternary | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
SameElementsInConditionViolation,
)
from wemake_python_styleguide.visitors.ast.conditions import (
BooleanConditionVisitor,
)
@pytest.mark.parametrize('code', [
'some or other',
'other and some',
... | [SameElementsInConditionViolation]) | added | f4eaf27367399f6d7a09113a9c75fb3dabe76aa91a6a6afe49d2985ae6197e42 | assert_*|test_duplicate_element_and_ternary|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( SameElementsInConditionViolation, ) from wemake_python_styleguide.visitors.ast.conditions import ( BooleanConditionVisitor, ) @pytest.mark.parametrize('code', [ 'some or oth... | null | null | null |
wemake-services/wemake-python-styleguide | train | 213 | 5a852714a523e035c0a224d1b214242b9e55b986 | train | tests/test_checker/test_noqa.py | test | wemake-services/wemake-python-styleguide:tests/test_checker/test_noqa.py | 169 | 8 | assert | # -*- coding: utf-8 -*-
import re
import subprocess
import types
from collections import Counter
ERROR_PATTERN = re.compile(r'(Z\d{3})')
IGNORED_VIOLATIONS = (
'Z202', # since our test case is complex, that's fine
'Z226', # we have a lot of ugly strings inside,
'Z402', # since we obviously use a lot of... | errors | added | 85c477f2caed1cc11c4d68201196149047113fe7b1c4ce3d9b3c6911cd5a3cdd | assert||# -*- coding: utf-8 -*- import re import subprocess import types from collections import Counter ERROR_PATTERN = re.compile(r'(Z\d{3})') IGNORED_VIOLATIONS = ( 'Z202', # since our test case is complex, that's fine 'Z226', # we have a lot of ugly strings inside, 'Z402', # since we obviously use a lot of `noqa` c... | null | null | null | |
wemake-services/wemake-python-styleguide | train | 213 | 5a852714a523e035c0a224d1b214242b9e55b986 | train | tests/test_checker/test_noqa.py | test | wemake-services/wemake-python-styleguide:tests/test_checker/test_noqa.py | 172 | 8 | assert | # -*- coding: utf-8 -*-
import re
import subprocess
import types
from collections import Counter
ERROR_PATTERN = re.compile(r'(Z\d{3})')
IGNORED_VIOLATIONS = (
'Z202', # since our test case is complex, that's fine
'Z226', # we have a lot of ugly strings inside,
'Z402', # since we obviously use a lot of... | errors | added | 97fbd5fd72441fb2720b1a864a78b10180a2df51caedeb910991a101bf7cb0ef | assert||# -*- coding: utf-8 -*- import re import subprocess import types from collections import Counter ERROR_PATTERN = re.compile(r'(Z\d{3})') IGNORED_VIOLATIONS = ( 'Z202', # since our test case is complex, that's fine 'Z226', # we have a lot of ugly strings inside, 'Z402', # since we obviously use a lot of `noqa` c... | null | null | null | |
wemake-services/wemake-python-styleguide | train | 213 | 5a852714a523e035c0a224d1b214242b9e55b986 | train | tests/test_checker/test_noqa.py | test | wemake-services/wemake-python-styleguide:tests/test_checker/test_noqa.py | 173 | 8 | assert | # -*- coding: utf-8 -*-
import re
import subprocess
import types
from collections import Counter
ERROR_PATTERN = re.compile(r'(Z\d{3})')
IGNORED_VIOLATIONS = (
'Z202', # since our test case is complex, that's fine
'Z226', # we have a lot of ugly strings inside,
'Z402', # since we obviously use a lot of... | errors.get(found_error) | added | 4954995474f9221a28665c08fe5fbbcabb42f17d6cac2b4ca332f8b59e0de4ee | assert||# -*- coding: utf-8 -*- import re import subprocess import types from collections import Counter ERROR_PATTERN = re.compile(r'(Z\d{3})') IGNORED_VIOLATIONS = ( 'Z202', # since our test case is complex, that's fine 'Z226', # we have a lot of ugly strings inside, 'Z402', # since we obviously use a lot of `noqa` c... | null | null | null | |
wemake-services/wemake-python-styleguide | train | 214 | f2b9376ac684b7a409204a382d2ca266302e7103 | train | tests/test_formatter/test_formatter_output.py | train | wemake-services/wemake-python-styleguide:tests/test_formatter/test_formatter_output.py | 54 | 4 | assert_* | test_formatter | # -*- coding: utf-8 -*-
"""
We use direct string assertiong on the formatter.
So, no unit tests for formatter, only e2e ones.
We use ``snapshottest`` to render and assert equality of the output:
https://github.com/syrusakbary/snapshottest
Warning::
Files inside ``./snapshots`` are auto generated!
Do not ed... | 'formatter_{0}'.format(output)) | added | bdf80433233e0a3b71196e88b8798180cb3171a4bf7d36882a95e62410403841 | assert_*|test_formatter|# -*- coding: utf-8 -*- """ We use direct string assertiong on the formatter. So, no unit tests for formatter, only e2e ones. We use ``snapshottest`` to render and assert equality of the output: https://github.com/syrusakbary/snapshottest Warning:: Files inside ``./snapshots`` are auto generated... | null | null | null |
wemake-services/wemake-python-styleguide | train | 215 | ec1545e69fb163896bd2f55d27ce781a2c3b39d4 | train | tests/test_formatter/test_formatter_output.py | train | wemake-services/wemake-python-styleguide:tests/test_formatter/test_formatter_output.py | 56 | 4 | assert_* | test_formatter | # -*- coding: utf-8 -*-
"""
We use direct string assertiong on the formatter.
So, no unit tests for formatter, only e2e ones.
We use ``snapshottest`` to render and assert equality of the output:
https://github.com/syrusakbary/snapshottest
Warning::
Files inside ``./snapshots`` are auto generated!
Do not ed... | 'formatter_{0}'.format(output)) | modified | 61fbf1c545f2645c86d68c4791e2402e721ccb1e1090ce5ac9b759c0ee5d44a3 | assert_*|test_formatter|# -*- coding: utf-8 -*- """ We use direct string assertiong on the formatter. So, no unit tests for formatter, only e2e ones. We use ``snapshottest`` to render and assert equality of the output: https://github.com/syrusakbary/snapshottest Warning:: Files inside ``./snapshots`` are auto generated... | 'formatter_{0}'.format(output)) | 54 | 4 |
wemake-services/wemake-python-styleguide | train | 216 | 1fe8aeeaffcf4468ead944470eb5b1ee0df8c983 | train | tests/test_formatter/test_formatter_output.py | train | wemake-services/wemake-python-styleguide:tests/test_formatter/test_formatter_output.py | 59 | 4 | assert_* | test_formatter | # -*- coding: utf-8 -*-
"""
We use direct string assertiong on the formatter.
So, no unit tests for formatter, only e2e ones.
We use ``snapshottest`` to render and assert equality of the output:
https://github.com/syrusakbary/snapshottest
Warning::
Files inside ``./snapshots`` are auto generated!
Do not ed... | 'formatter_{0}'.format(output)) | modified | 7a6aeafd606d517e981e7e988b5c91ec101d7ec0c085e398957ee96ae9471966 | assert_*|test_formatter|# -*- coding: utf-8 -*- """ We use direct string assertiong on the formatter. So, no unit tests for formatter, only e2e ones. We use ``snapshottest`` to render and assert equality of the output: https://github.com/syrusakbary/snapshottest Warning:: Files inside ``./snapshots`` are auto generated... | 'formatter_{0}'.format(output)) | 56 | 4 |
wemake-services/wemake-python-styleguide | train | 217 | 50cdcedf32652a2a09b1705cddf59d0d2d385d5e | train | tests/test_formatter/test_formatter_output.py | train | wemake-services/wemake-python-styleguide:tests/test_formatter/test_formatter_output.py | 63 | 4 | assert_* | test_formatter | # -*- coding: utf-8 -*-
"""
We use direct string assertiong on the formatter.
So, no unit tests for formatter, only e2e ones.
We use ``snapshottest`` to render and assert equality of the output:
https://github.com/syrusakbary/snapshottest
To update snapshots use ``--snapshot-update`` flag, when running ``pytest``.
... | 'formatter_{0}'.format(output)) | added | 7187d1fdc6d29228cb42f52cf1e8fe0254b78123a6fcbd9fd85ccca37577225f | assert_*|test_formatter|# -*- coding: utf-8 -*- """ We use direct string assertiong on the formatter. So, no unit tests for formatter, only e2e ones. We use ``snapshottest`` to render and assert equality of the output: https://github.com/syrusakbary/snapshottest To update snapshots use ``--snapshot-update`` flag, when ... | null | null | null |
wemake-services/wemake-python-styleguide | train | 218 | 815fec9711e222af67718f398d9b73d083c65327 | train | tests/test_formatter/test_formatter_output.py | train | wemake-services/wemake-python-styleguide:tests/test_formatter/test_formatter_output.py | 94 | 4 | assert_* | test_formatter_correct | # -*- coding: utf-8 -*-
"""
We use direct string assertiong on the formatter.
So, no unit tests for formatter, only e2e ones.
We use ``snapshottest`` to render and assert equality of the output:
https://github.com/syrusakbary/snapshottest
To update snapshots use ``--snapshot-update`` flag, when running ``pytest``.
... | 'formatter_correct_{0}'.format(output)) | added | 73628175e1d613584df50687ff1307b9ad4abfeb25ed0bff7d828477229bec90 | assert_*|test_formatter_correct|# -*- coding: utf-8 -*- """ We use direct string assertiong on the formatter. So, no unit tests for formatter, only e2e ones. We use ``snapshottest`` to render and assert equality of the output: https://github.com/syrusakbary/snapshottest To update snapshots use ``--snapshot-update`` fla... | null | null | null |
wemake-services/wemake-python-styleguide | train | 219 | 2999dd92ece46f2dbf1ccc0069b6dab7f16d320d | train | tests/test_visitors/test_ast/test_annotations/test_argument_annotations.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_annotations/test_argument_annotations.py | 72 | 4 | assert_* | test_wrong_argument_annotation | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.annotations import (
MultilineFunctionAnnotationViolation,
WrongAnnotationVisitor,
)
# Correct:
correct_function_without_arguments = """
def function(): ...
"""
correct_function_without_annotations = """
def function(arg, arg1... | [MultilineFunctionAnnotationViolation]) | modified | 1835415a8fd2ad63d8294b714f40b4c0df7137b02b414c15a2822e8e12fb848c | assert_*|test_wrong_argument_annotation|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.annotations import ( MultilineFunctionAnnotationViolation, WrongAnnotationVisitor, ) # Correct: correct_function_without_arguments = """ def function(): ... """ correct_function_without_annotations =... | [MultilineFunctionAnnotationViolation]) | 72 | 4 |
wemake-services/wemake-python-styleguide | train | 219 | 2999dd92ece46f2dbf1ccc0069b6dab7f16d320d | train | tests/test_visitors/test_ast/test_attributes/test_magic_attributes.py | test | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_attributes/test_magic_attributes.py | 139 | 4 | assert_* | test_magic_attribute_is_restricted | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.attributes import (
DirectMagicAttributeAccessViolation,
WrongAttributeVisitor,
)
# Wrong:
magic_attribute_assigned = 'some.__magic__ = 1'
magic_attribute_accessed = 'print(some.__magic__)'
magic_method_called = 'some.__magic__... | [DirectMagicAttributeAccessViolation]) | modified | b517ef7f70e635b2a76ef4100fc07dd16a87d06fc3f8d59a83eee7acb4228465 | assert_*|test_magic_attribute_is_restricted|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.attributes import ( DirectMagicAttributeAccessViolation, WrongAttributeVisitor, ) # Wrong: magic_attribute_assigned = 'some.__magic__ = 1' magic_attribute_accessed = 'print(some.__magic__)' magic... | [DirectMagicAttributeAccessViolation]) | 139 | 4 |
wemake-services/wemake-python-styleguide | train | 219 | 2999dd92ece46f2dbf1ccc0069b6dab7f16d320d | train | tests/test_visitors/test_ast/test_attributes/test_protected_attributes.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_attributes/test_protected_attributes.py | 137 | 4 | assert_* | test_protected_attribute_is_restricted | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.attributes import (
ProtectedAttributeViolation,
WrongAttributeVisitor,
)
# Wrong:
protected_attribute_assigned = 'some._protected = 1'
protected_attribute_accessed = 'print(some._protected)'
protected_method_called = 'some._pr... | '_protected') | modified | d41ac98035703eaa45e2996659e9d12a1349f887bc0f89286f7a86c369cf2593 | assert_*|test_protected_attribute_is_restricted|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.attributes import ( ProtectedAttributeViolation, WrongAttributeVisitor, ) # Wrong: protected_attribute_assigned = 'some._protected = 1' protected_attribute_accessed = 'print(some._protected)'... | '_protected') | 137 | 4 |
wemake-services/wemake-python-styleguide | train | 219 | 2999dd92ece46f2dbf1ccc0069b6dab7f16d320d | train | tests/test_visitors/test_ast/test_builtins/test_magic_numbers.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_builtins/test_magic_numbers.py | 186 | 4 | assert_* | test_magic_number_warning | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.constants import MAGIC_NUMBERS_WHITELIST
from wemake_python_styleguide.violations.best_practices import (
MagicNumberViolation,
)
from wemake_python_styleguide.visitors.ast.builtins import MagicNumberVisitor
# Correct usages:
assignment = 'cons... | [MagicNumberViolation]) | modified | e1ed0d5020a289f8afa1fa0e6679525b01cd672c2e151466dd1c286cc2378687 | assert_*|test_magic_number_warning|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.constants import MAGIC_NUMBERS_WHITELIST from wemake_python_styleguide.violations.best_practices import ( MagicNumberViolation, ) from wemake_python_styleguide.visitors.ast.builtins import MagicNumberVisitor # Correct... | [MagicNumberViolation]) | 186 | 4 |
wemake-services/wemake-python-styleguide | train | 219 | 2999dd92ece46f2dbf1ccc0069b6dab7f16d320d | train | tests/test_visitors/test_ast/test_classes/test_class_attributes/test_slots_syntax.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_classes/test_class_attributes/test_slots_syntax.py | 46 | 4 | assert_* | test_incorrect_slots | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
WrongSlotsViolation,
)
from wemake_python_styleguide.visitors.ast.classes import WrongSlotsVisitor
class_body_template = """
class ClassWithSlots(object):
__slots__ = {0}
"""
class_body_typed_template = ""... | [WrongSlotsViolation]) | modified | 10210f515c6e3748bf71abf887d38d682e2048f7c88f01100364850eacae62d6 | assert_*|test_incorrect_slots|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( WrongSlotsViolation, ) from wemake_python_styleguide.visitors.ast.classes import WrongSlotsVisitor class_body_template = """ class ClassWithSlots(object): __slots__ = {0} """ class_body_t... | [IncorrectSlotsViolation]) | 46 | 4 |
wemake-services/wemake-python-styleguide | train | 219 | 2999dd92ece46f2dbf1ccc0069b6dab7f16d320d | train | tests/test_visitors/test_ast/test_functions/test_super_call.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_functions/test_super_call.py | 120 | 4 | assert_* | test_double_wrong_super_call | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
WrongSuperCallViolation,
)
from wemake_python_styleguide.visitors.ast.functions import (
WrongFunctionCallVisitor,
)
# Correct:
correct_super_call = """
class Example(object):
def some_method(self, arg... | [ WrongSuperCallViolation, WrongSuperCallViolation, ]) | modified | 62a302873a247cbb2107d01962e6fc1d7695b5cc21abe48cda144114c5fa103f | assert_*|test_double_wrong_super_call|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( WrongSuperCallViolation, ) from wemake_python_styleguide.visitors.ast.functions import ( WrongFunctionCallVisitor, ) # Correct: correct_super_call = """ class Example(object): def... | [ IncorrectSuperCallViolation, IncorrectSuperCallViolation, ]) | 120 | 4 |
wemake-services/wemake-python-styleguide | train | 219 | 2999dd92ece46f2dbf1ccc0069b6dab7f16d320d | train | tests/test_visitors/test_ast/test_imports/test_nested_imports.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_imports/test_nested_imports.py | 68 | 4 | assert_* | test_nested_import | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
NestedImportViolation,
)
from wemake_python_styleguide.visitors.ast.imports import WrongImportVisitor
# Wrong imports:
nested_function_import = """
def function():
import os
"""
nested_function_from_impor... | [NestedImportViolation]) | modified | e682bada6c357c5b9feaee77766d40f066210451d44608237fa355bdf544fc01 | assert_*|test_nested_import|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( NestedImportViolation, ) from wemake_python_styleguide.visitors.ast.imports import WrongImportVisitor # Wrong imports: nested_function_import = """ def function(): import os """ nested_func... | [NestedImportViolation]) | 68 | 4 |
wemake-services/wemake-python-styleguide | train | 219 | 2999dd92ece46f2dbf1ccc0069b6dab7f16d320d | train | tests/test_visitors/test_tokenize/test_primitives/test_string_tokens/test_string_multiline.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_tokenize/test_primitives/test_string_tokens/test_string_multiline.py | 79 | 4 | assert_* | test_incorrect_multiline_strings | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.consistency import (
WrongMultilineStringViolation,
)
from wemake_python_styleguide.visitors.tokenize.primitives import (
WrongStringTokenVisitor,
)
multiline_single = """'''
abc
'''"""
multiline_double = '''"""
abc
"""'''
# Doc... | [WrongMultilineStringViolation]) | modified | 8fa9ea04c90be1d4f93ede4c4e854d6f91941185f85326cbf94a87022fce1928 | assert_*|test_incorrect_multiline_strings|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.consistency import ( WrongMultilineStringViolation, ) from wemake_python_styleguide.visitors.tokenize.primitives import ( WrongStringTokenVisitor, ) multiline_single = """''' abc '''""" multiline_dou... | [IncorrectMultilineStringViolation]) | 79 | 4 |
wemake-services/wemake-python-styleguide | train | 220 | b6b63dfe2bf63538ff575229956cda539e4713d2 | train | tests/fixtures/noqa.py | train | wemake-services/wemake-python-styleguide:tests/fixtures/noqa.py | 198 | 0 | assert | # -*- coding: utf-8 -*-
"""
This file contains all possible violations.
It is used for e2e tests.
"""
from __future__ import print_function # noqa: WPS422
import os.path # noqa: WPS301
import sys as sys # noqa: WPS113
from some import _protected # noqa: WPS440
from .version import get_version # noqa: WPS300
... | octal_number | modified | 53501f387a36349cb3baa6c5d28b863d3eedfa618601d02cfabb93d81b8fcb1c | assert||# -*- coding: utf-8 -*- """ This file contains all possible violations. It is used for e2e tests. """ from __future__ import print_function # noqa: WPS422 import os.path # noqa: WPS301 import sys as sys # noqa: WPS113 from some import _protected # noqa: WPS440 from .version import get_version # noqa: WPS300 ful... | octal_number | 198 | 0 | |
wemake-services/wemake-python-styleguide | train | 220 | b6b63dfe2bf63538ff575229956cda539e4713d2 | train | tests/test_checker/test_invalid_options.py | train | wemake-services/wemake-python-styleguide:tests/test_checker/test_invalid_options.py | 26 | 4 | assert | test_invalid_options | # -*- coding: utf-8 -*-
import subprocess
def test_invalid_options(absolute_path):
"""End-to-End test to check option validation works."""
process = subprocess.Popen(
[
'flake8',
'--isolated',
'--select',
'WPS',
'--max-imports',
... | stderr | modified | 8a91b0797d9ccdd48618add8b09bc06cb39afd5e170c01b771cdc41dbd828b73 | assert|test_invalid_options|# -*- coding: utf-8 -*- import subprocess def test_invalid_options(absolute_path): """End-to-End test to check option validation works.""" process = subprocess.Popen( [ 'flake8', '--isolated', '--select', 'WPS', '--max-imports', '-5', # should be positive absolute_path('fixtures', 'noqa.py')... | stderr | 26 | 4 |
wemake-services/wemake-python-styleguide | train | 220 | b6b63dfe2bf63538ff575229956cda539e4713d2 | train | tests/test_checker/test_noqa.py | test | wemake-services/wemake-python-styleguide:tests/test_checker/test_noqa.py | 169 | 8 | assert | # -*- coding: utf-8 -*-
import re
import subprocess
import types
from collections import Counter
ERROR_PATTERN = re.compile(r'(WPS\d{3})')
IGNORED_VIOLATIONS = (
'WPS202', # since our test case is complex, that's fine
'WPS226', # we have a lot of ugly strings inside,
'WPS402', # since we obviously use ... | errors | added | a4abcd383b9c4f67782fed0ed1f438b9d0889a945f7f924313c7c79b4b726b6a | assert||# -*- coding: utf-8 -*- import re import subprocess import types from collections import Counter ERROR_PATTERN = re.compile(r'(WPS\d{3})') IGNORED_VIOLATIONS = ( 'WPS202', # since our test case is complex, that's fine 'WPS226', # we have a lot of ugly strings inside, 'WPS402', # since we obviously use a lot of ... | null | null | null | |
wemake-services/wemake-python-styleguide | train | 220 | b6b63dfe2bf63538ff575229956cda539e4713d2 | train | tests/test_formatter/test_formatter_output.py | train | wemake-services/wemake-python-styleguide:tests/test_formatter/test_formatter_output.py | 94 | 4 | assert_* | test_formatter_correct | # -*- coding: utf-8 -*-
"""
We use direct string assertiong on the formatter.
So, no unit tests for formatter, only e2e ones.
We use ``snapshottest`` to render and assert equality of the output:
https://github.com/syrusakbary/snapshottest
To update snapshots use ``--snapshot-update`` flag, when running ``pytest``.
... | 'formatter_correct_{0}'.format(output)) | modified | 5ff4ed7f5ebd97579efb42719ac220921dd468729f6b351751c098de6f2802f8 | assert_*|test_formatter_correct|# -*- coding: utf-8 -*- """ We use direct string assertiong on the formatter. So, no unit tests for formatter, only e2e ones. We use ``snapshottest`` to render and assert equality of the output: https://github.com/syrusakbary/snapshottest To update snapshots use ``--snapshot-update`` fla... | 'formatter_correct_{0}'.format(output)) | 94 | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.