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 | 22 | 93c580cb768617bef08abdb5b614443d9f62ba05 | train | tests/test_visitors/test_ast/test_wrong_name/test_class_attributes.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_wrong_name/test_class_attributes.py | 58 | 4 | assert_* | test_too_short_attribute_names | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.visitors.ast.wrong_name import (
BAD_VARIABLE_NAMES,
PrivateNameViolation,
TooShortVariableNameViolation,
WrongNameVisitor,
WrongVariableNameViolation,
)
static_attribute = """
class Test:
{0} = None
"""
insta... | [TooShortVariableNameViolation]) | modified | 0815055e6e4d808a9581c106dbbd63c78c2a1d26f67b94a31669eb6061eba42a | assert_*|test_too_short_attribute_names|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.visitors.ast.wrong_name import ( BAD_VARIABLE_NAMES, PrivateNameViolation, TooShortVariableNameViolation, WrongNameVisitor, WrongVariableNameViolation, ) static_attribute = """ class Test: {0} = Non... | [TooShortVariableNameViolation]) | 58 | 4 |
wemake-services/wemake-python-styleguide | train | 22 | 93c580cb768617bef08abdb5b614443d9f62ba05 | train | tests/test_visitors/test_ast/test_wrong_string.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_wrong_string.py | 53 | 4 | assert_* | test_wrong_string | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.wrong_string import (
FormattedStringViolation,
WrongStringVisitor,
)
regular_string = "'some value'"
string_variable = "some = '123'"
formated_string = "'x + y = {0}'.format(2)"
key_formated_string = "'x + y = {res}'.format(res... | [FormattedStringViolation]) | modified | d11eeb5f7b31ee0b168709a8a5410357e0ef0869ca5bd945aaf6971eb2476b6f | assert_*|test_wrong_string|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.wrong_string import ( FormattedStringViolation, WrongStringVisitor, ) regular_string = "'some value'" string_variable = "some = '123'" formated_string = "'x + y = {0}'.format(2)" key_formated_string = "'x + y = {... | [FormattedStringViolation]) | 53 | 4 |
wemake-services/wemake-python-styleguide | train | 22 | 93c580cb768617bef08abdb5b614443d9f62ba05 | train | tests/test_visitors/test_filenames/test_wrong_module_name/test_module_name_length.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_filenames/test_wrong_module_name/test_module_name_length.py | 31 | 4 | assert_* | test_length_option | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.filenames.wrong_module_name import (
TooShortModuleNameViolation,
WrongModuleNameVisitor,
)
@pytest.mark.parametrize('filename', [
'a.py',
'some/package/z.py',
'/root/x.py',
'C:/f.py',
])
def test_too_short_filename... | [TooShortModuleNameViolation]) | added | 31b24db93025000d7aae9496a696ece540cfab02b711a94911c42b07ec95de51 | assert_*|test_length_option|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.filenames.wrong_module_name import ( TooShortModuleNameViolation, WrongModuleNameVisitor, ) @pytest.mark.parametrize('filename', [ 'a.py', 'some/package/z.py', '/root/x.py', 'C:/f.py', ]) def test_too_short_filename... | null | null | null |
wemake-services/wemake-python-styleguide | train | 23 | 087f594d7692563e41b643fd541eb2ad33df49c0 | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 48 | 12 | assert | # -*- coding: utf-8 -*-
import ast
from collections import namedtuple
from textwrap import dedent
from typing import Sequence
import pytest
from wemake_python_styleguide.options import defaults
from wemake_python_styleguide.visitors.base import BaseNodeVisitor
def maybe_set_parent(tree: ast.AST) -> ast.AST:
""... | index | added | 012bd6b38606cbb4ee7d458b2a46872b8da454fa58f61600f626ad4c9f57b968 | assert||# -*- coding: utf-8 -*- import ast from collections import namedtuple from textwrap import dedent from typing import Sequence import pytest from wemake_python_styleguide.options import defaults from wemake_python_styleguide.visitors.base import BaseNodeVisitor def maybe_set_parent(tree: ast.AST) -> ast.AST: """... | null | null | null | |
wemake-services/wemake-python-styleguide | train | 23 | 087f594d7692563e41b643fd541eb2ad33df49c0 | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 49 | 12 | assert | # -*- coding: utf-8 -*-
import ast
from collections import namedtuple
from textwrap import dedent
from typing import Sequence
import pytest
from wemake_python_styleguide.options import defaults
from wemake_python_styleguide.visitors.base import BaseNodeVisitor
def maybe_set_parent(tree: ast.AST) -> ast.AST:
""... | errors[index].code | added | 6156c17f56747b738c40faaaad12bf0470bf715552c6aa321d6e8e830c949eca | assert||# -*- coding: utf-8 -*- import ast from collections import namedtuple from textwrap import dedent from typing import Sequence import pytest from wemake_python_styleguide.options import defaults from wemake_python_styleguide.visitors.base import BaseNodeVisitor def maybe_set_parent(tree: ast.AST) -> ast.AST: """... | null | null | null | |
wemake-services/wemake-python-styleguide | train | 23 | 087f594d7692563e41b643fd541eb2ad33df49c0 | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 51 | 8 | assert | # -*- coding: utf-8 -*-
import ast
from collections import namedtuple
from textwrap import dedent
from typing import Sequence
import pytest
from wemake_python_styleguide.options import defaults
from wemake_python_styleguide.visitors.base import BaseNodeVisitor
def maybe_set_parent(tree: ast.AST) -> ast.AST:
""... | len(errors) | added | 423fbec7d00699cd32ac7f5aea12730e2c0ddc2f4955625b56a38b16f54c64c9 | assert||# -*- coding: utf-8 -*- import ast from collections import namedtuple from textwrap import dedent from typing import Sequence import pytest from wemake_python_styleguide.options import defaults from wemake_python_styleguide.visitors.base import BaseNodeVisitor def maybe_set_parent(tree: ast.AST) -> ast.AST: """... | null | null | null | |
wemake-services/wemake-python-styleguide | train | 25 | bce64244e78dbd1cba933f58d9a6ce70d7a66987 | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 48 | 12 | assert | # -*- coding: utf-8 -*-
import ast
from collections import namedtuple
from textwrap import dedent
from typing import Sequence
import pytest
from wemake_python_styleguide.options import defaults
from wemake_python_styleguide.visitors.base import BaseNodeVisitor
def maybe_set_parent(tree: ast.AST) -> ast.AST:
""... | index | modified | e7c3cbc6fc6ba2726fac4c2bb14382729ac392b30ec0341a2f782ce280f1dbf3 | assert||# -*- coding: utf-8 -*- import ast from collections import namedtuple from textwrap import dedent from typing import Sequence import pytest from wemake_python_styleguide.options import defaults from wemake_python_styleguide.visitors.base import BaseNodeVisitor def maybe_set_parent(tree: ast.AST) -> ast.AST: """... | index | 48 | 12 | |
wemake-services/wemake-python-styleguide | train | 25 | bce64244e78dbd1cba933f58d9a6ce70d7a66987 | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 49 | 12 | assert | # -*- coding: utf-8 -*-
import ast
from collections import namedtuple
from textwrap import dedent
from typing import Sequence
import pytest
from wemake_python_styleguide.options import defaults
from wemake_python_styleguide.visitors.base import BaseNodeVisitor
def maybe_set_parent(tree: ast.AST) -> ast.AST:
""... | errors[index].code | modified | cc9065cdf2c184c8d91d0a500f45a3acedbd57044613839b77757d48b9953ca3 | assert||# -*- coding: utf-8 -*- import ast from collections import namedtuple from textwrap import dedent from typing import Sequence import pytest from wemake_python_styleguide.options import defaults from wemake_python_styleguide.visitors.base import BaseNodeVisitor def maybe_set_parent(tree: ast.AST) -> ast.AST: """... | errors[index].code | 49 | 12 | |
wemake-services/wemake-python-styleguide | train | 25 | bce64244e78dbd1cba933f58d9a6ce70d7a66987 | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 51 | 8 | assert | # -*- coding: utf-8 -*-
import ast
from collections import namedtuple
from textwrap import dedent
from typing import Sequence
import pytest
from wemake_python_styleguide.options import defaults
from wemake_python_styleguide.visitors.base import BaseNodeVisitor
def maybe_set_parent(tree: ast.AST) -> ast.AST:
""... | len(errors) | modified | 51830f7fdc8c80cd6f713db7aed68608d3e0f91c462bf7c9008603d034e85fe3 | assert||# -*- coding: utf-8 -*- import ast from collections import namedtuple from textwrap import dedent from typing import Sequence import pytest from wemake_python_styleguide.options import defaults from wemake_python_styleguide.visitors.base import BaseNodeVisitor def maybe_set_parent(tree: ast.AST) -> ast.AST: """... | len(errors) | 51 | 8 | |
wemake-services/wemake-python-styleguide | train | 26 | d5a9841026122aec8f7dab0a5a4fe3d748cbe04d | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 52 | 12 | assert | # -*- coding: utf-8 -*-
import ast
from collections import namedtuple
from textwrap import dedent
from typing import Sequence
import pytest
from wemake_python_styleguide.options.config import Configuration
from wemake_python_styleguide.visitors.base import BaseNodeVisitor
def _maybe_set_parent(tree: ast.AST) -> as... | index | modified | 027e104af09d3cb80e0832b12800baea180d414c422b0dd8ba0c621f4da2c00c | assert||# -*- coding: utf-8 -*- import ast from collections import namedtuple from textwrap import dedent from typing import Sequence import pytest from wemake_python_styleguide.options.config import Configuration from wemake_python_styleguide.visitors.base import BaseNodeVisitor def _maybe_set_parent(tree: ast.AST) ->... | errors[index].code | 49 | 12 | |
wemake-services/wemake-python-styleguide | train | 26 | d5a9841026122aec8f7dab0a5a4fe3d748cbe04d | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 53 | 12 | assert | # -*- coding: utf-8 -*-
import ast
from collections import namedtuple
from textwrap import dedent
from typing import Sequence
import pytest
from wemake_python_styleguide.options.config import Configuration
from wemake_python_styleguide.visitors.base import BaseNodeVisitor
def _maybe_set_parent(tree: ast.AST) -> as... | errors[index].code | modified | ea58c615fd9d934150c5560ce7e60e1ce344726f299e451557a2f7d8ea04c766 | assert||# -*- coding: utf-8 -*- import ast from collections import namedtuple from textwrap import dedent from typing import Sequence import pytest from wemake_python_styleguide.options.config import Configuration from wemake_python_styleguide.visitors.base import BaseNodeVisitor def _maybe_set_parent(tree: ast.AST) ->... | len(errors) | 51 | 8 | |
wemake-services/wemake-python-styleguide | train | 26 | d5a9841026122aec8f7dab0a5a4fe3d748cbe04d | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 55 | 8 | assert | # -*- coding: utf-8 -*-
import ast
from collections import namedtuple
from textwrap import dedent
from typing import Sequence
import pytest
from wemake_python_styleguide.options.config import Configuration
from wemake_python_styleguide.visitors.base import BaseNodeVisitor
def _maybe_set_parent(tree: ast.AST) -> as... | len(errors) | added | f4e74367efaf4a053f996ffb2857de5ca7511766462a69fa5cb92d5eb1cc62ac | assert||# -*- coding: utf-8 -*- import ast from collections import namedtuple from textwrap import dedent from typing import Sequence import pytest from wemake_python_styleguide.options.config import Configuration from wemake_python_styleguide.visitors.base import BaseNodeVisitor def _maybe_set_parent(tree: ast.AST) ->... | null | null | null | |
wemake-services/wemake-python-styleguide | train | 26 | d5a9841026122aec8f7dab0a5a4fe3d748cbe04d | train | tests/test_visitors/test_ast/test_complexity/test_jones/test_line_complexity.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_complexity/test_jones/test_line_complexity.py | 63 | 4 | assert_* | test_complex_lines | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.complexity.jones import (
JonesComplexityVisitor,
LineComplexityViolation,
)
line_simple = 'x = 2'
line_with_types = 'x: int = 2'
line_with_comprehension = 'x = [f for f in "abc"]'
line_with_math = 'x = y * 2 + 19 / 9.3'
line_in... | [LineComplexityViolation]) | added | 207fa6e4b2a5a78fb926d071476d135341311c49102e23cc48d4ddc327b221c5 | assert_*|test_complex_lines|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.complexity.jones import ( JonesComplexityVisitor, LineComplexityViolation, ) line_simple = 'x = 2' line_with_types = 'x: int = 2' line_with_comprehension = 'x = [f for f in "abc"]' line_with_math = 'x = y * 2 + ... | null | null | null |
wemake-services/wemake-python-styleguide | train | 26 | d5a9841026122aec8f7dab0a5a4fe3d748cbe04d | train | tests/test_visitors/test_ast/test_complexity/test_jones/test_line_complexity.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_complexity/test_jones/test_line_complexity.py | 83 | 4 | assert | test_same_complexity | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.complexity.jones import (
JonesComplexityVisitor,
LineComplexityViolation,
)
line_simple = 'x = 2'
line_with_types = 'x: int = 2'
line_with_comprehension = 'x = [f for f in "abc"]'
line_with_math = 'x = y * 2 + 19 / 9.3'
line_in... | len(typed_visitor._lines[1]) | added | 25aa2efe8cdda9fec1d17e730d4ee78e81d3d8e4defe43c51179f7136c484b5f | assert|test_same_complexity|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.complexity.jones import ( JonesComplexityVisitor, LineComplexityViolation, ) line_simple = 'x = 2' line_with_types = 'x: int = 2' line_with_comprehension = 'x = [f for f in "abc"]' line_with_math = 'x = y * 2 + ... | null | null | null |
wemake-services/wemake-python-styleguide | train | 26 | d5a9841026122aec8f7dab0a5a4fe3d748cbe04d | train | tests/test_visitors/test_ast/test_complexity/test_jones/test_line_complexity.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_complexity/test_jones/test_line_complexity.py | 98 | 4 | assert | test_exact_complexity | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.complexity.jones import (
JonesComplexityVisitor,
LineComplexityViolation,
)
line_simple = 'x = 2'
line_with_types = 'x: int = 2'
line_with_comprehension = 'x = [f for f in "abc"]'
line_with_math = 'x = y * 2 + 19 / 9.3'
line_in... | complexity | added | 55be8ff31399bfe82daca0c27f770cb71a1de0ce6c0e1cfd7a83446ee936d75c | assert|test_exact_complexity|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.complexity.jones import ( JonesComplexityVisitor, LineComplexityViolation, ) line_simple = 'x = 2' line_with_types = 'x: int = 2' line_with_comprehension = 'x = [f for f in "abc"]' line_with_math = 'x = y * 2 +... | null | null | null |
wemake-services/wemake-python-styleguide | train | 26 | d5a9841026122aec8f7dab0a5a4fe3d748cbe04d | train | tests/test_visitors/test_ast/test_complexity/test_jones/test_module_complexity.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_complexity/test_jones/test_module_complexity.py | 43 | 4 | assert_* | test_module_score_error | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.complexity.jones import (
JonesComplexityVisitor,
JonesScoreViolation,
)
module_without_nodes = ''
module_with_nodes = """
some = 1 + 2
other = [number for number in range(0, some)]
"""
@pytest.mark.parametrize('code', [
m... | [JonesScoreViolation]) | added | 89d7465696cfc768b9ebaf24247c72c0748319ce2edf468bc911229988871b9d | assert_*|test_module_score_error|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.complexity.jones import ( JonesComplexityVisitor, JonesScoreViolation, ) module_without_nodes = '' module_with_nodes = """ some = 1 + 2 other = [number for number in range(0, some)] """ @pytest.mark.paramet... | null | null | null |
wemake-services/wemake-python-styleguide | train | 27 | fc8ced64cbe97e5da179fb22543a68293650bd89 | train | tests/test_version.py | train | wemake-services/wemake-python-styleguide:tests/test_version.py | 16 | 4 | assert | test_call_flake8_version | # -*- coding: utf-8 -*-
import subprocess
from wemake_python_styleguide.version import pkg_name, pkg_version
def test_call_flake8_version():
"""Checks that module is registered and visible in the meta data."""
output = subprocess.check_output(
['flake8', '--version'],
stderr=subprocess.STDOU... | output_text | modified | d35a6d85b9107fc48e69dcee49574f55107012d54c2bc77a6e8eeeb45e3b4c81 | assert|test_call_flake8_version|# -*- coding: utf-8 -*- import subprocess from wemake_python_styleguide.version import pkg_name, pkg_version def test_call_flake8_version(): """Checks that module is registered and visible in the meta data.""" output = subprocess.check_output( ['flake8', '--version'], stderr=subprocess.S... | output_text | 16 | 4 |
wemake-services/wemake-python-styleguide | train | 27 | fc8ced64cbe97e5da179fb22543a68293650bd89 | train | tests/test_visitors/test_ast/test_complexity/test_counts/test_imports_counts.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_complexity/test_counts/test_imports_counts.py | 53 | 4 | assert_* | test_module_import_counts_violation | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.complexity.counts import (
ImportMembersVisitor,
TooManyImportsViolation,
)
module_import = ''
module_with_regular_imports = """
import sys
import os
"""
module_with_from_imports = """
from os import path
from sys import versio... | [TooManyImportsViolation]) | added | 9277bed6b22f751c0cc0ce2fde9515e1d134aa03c31add4439a7f4719eb7f70d | assert_*|test_module_import_counts_violation|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.complexity.counts import ( ImportMembersVisitor, TooManyImportsViolation, ) module_import = '' module_with_regular_imports = """ import sys import os """ module_with_from_imports = """ from os i... | null | null | null |
wemake-services/wemake-python-styleguide | train | 27 | fc8ced64cbe97e5da179fb22543a68293650bd89 | train | tests/test_visitors/test_ast/test_complexity/test_counts/test_module_counts.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_complexity/test_counts/test_module_counts.py | 55 | 4 | assert_* | test_module_counts_violation | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.complexity.counts import (
ModuleMembersVisitor,
TooManyModuleMembersViolation,
)
module_with_function_and_class = """
def first(): ...
class Second(object): ...
"""
module_with_methods = """
class First(object):
def metho... | [TooManyModuleMembersViolation]) | modified | d87095fb4108b1ccff2044c61db3d60ce01d364903d05d0b89dec6050acf4bdc | assert_*|test_module_counts_violation|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.complexity.counts import ( ModuleMembersVisitor, TooManyModuleMembersViolation, ) module_with_function_and_class = """ def first(): ... class Second(object): ... """ module_with_methods = """ class Fir... | [TooManyModuleMembersViolation]) | 55 | 4 |
wemake-services/wemake-python-styleguide | train | 27 | fc8ced64cbe97e5da179fb22543a68293650bd89 | train | tests/test_visitors/test_ast/test_general/test_wrong_import/test_relative_imports.py | test | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_wrong_import/test_relative_imports.py | 36 | 4 | assert_* | test_local_folder_import | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.general.wrong_import import (
LocalFolderImportViolation,
WrongImportVisitor,
)
same_level_relative_import = 'from . import some'
same_level_relative_import_sibling = 'from .some import MyClass'
parent_level_relative_import = 'f... | [LocalFolderImportViolation]) | modified | e68a92c1cf8d118430c8a42dd58a231058fd1abff6c82501cb04904ab947c09a | assert_*|test_local_folder_import|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.general.wrong_import import ( LocalFolderImportViolation, WrongImportVisitor, ) same_level_relative_import = 'from . import some' same_level_relative_import_sibling = 'from .some import MyClass' parent_lev... | [LocalFolderImportViolation]) | 36 | 4 |
wemake-services/wemake-python-styleguide | train | 27 | fc8ced64cbe97e5da179fb22543a68293650bd89 | train | tests/test_visitors/test_ast/test_general/test_wrong_module/test_empty_modules.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_wrong_module/test_empty_modules.py | 28 | 4 | assert_* | test_simple_filename | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.general.wrong_module import (
EmptyModuleViolation,
WrongContentsVisitor,
)
@pytest.mark.parametrize('filename', [
'empty.py',
'/home/user/logics.py',
'partial/views.py',
'C:/path/package/module.py',
])
def test... | [EmptyModuleViolation]) | modified | 7d3f695a8402cf28d922cfd2eae5aa21bbd2568738edc839204ddf67b594a649 | assert_*|test_simple_filename|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.general.wrong_module import ( EmptyModuleViolation, WrongContentsVisitor, ) @pytest.mark.parametrize('filename', [ 'empty.py', '/home/user/logics.py', 'partial/views.py', 'C:/path/package/module.py', ]) def te... | [EmptyModuleViolation]) | 28 | 4 |
wemake-services/wemake-python-styleguide | train | 27 | fc8ced64cbe97e5da179fb22543a68293650bd89 | train | tests/test_visitors/test_ast/test_general/test_wrong_name/test_module_metadata.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_wrong_name/test_module_metadata.py | 39 | 4 | assert_* | test_wrong_metadata | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.general.wrong_name import (
BAD_MODULE_METADATA_VARIABLES,
WrongModuleMetadataViolation,
WrongModuleMetadataVisitor,
)
module_metadata = """
{0} = 'Nikita'
"""
nested_metadata = """
class ORM:
{0} = None
"""
startup_me... | [WrongModuleMetadataViolation]) | modified | 8b9451458d43b09dcd9db560e1be252804dd71804e74ccfe53985c2bc405584a | assert_*|test_wrong_metadata|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.general.wrong_name import ( BAD_MODULE_METADATA_VARIABLES, WrongModuleMetadataViolation, WrongModuleMetadataVisitor, ) module_metadata = """ {0} = 'Nikita' """ nested_metadata = """ class ORM: {0} = None """ st... | [WrongModuleMetadataViolation]) | 39 | 4 |
wemake-services/wemake-python-styleguide | train | 27 | fc8ced64cbe97e5da179fb22543a68293650bd89 | train | tests/test_visitors/test_base.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_base.py | 22 | 9 | pytest.raises | test_base_filename_raises_not_implemented | # -*- coding: utf-8 -*-
from unittest.mock import MagicMock
import pytest
from wemake_python_styleguide import constants
from wemake_python_styleguide.visitors.base import (
BaseFilenameVisitor,
BaseVisitor,
)
def test_visitor_raises_not_implemented(default_options):
"""Ensures that `BaseChecker` raise... | NotImplementedError) | added | 8df472fd0313925b9b1d97aafefd5e380ec9e310d0281665840e1bf10ca1097f | pytest.raises|test_base_filename_raises_not_implemented|# -*- coding: utf-8 -*- from unittest.mock import MagicMock import pytest from wemake_python_styleguide import constants from wemake_python_styleguide.visitors.base import ( BaseFilenameVisitor, BaseVisitor, ) def test_visitor_raises_not_implemented(default_option... | null | null | null |
wemake-services/wemake-python-styleguide | train | 27 | fc8ced64cbe97e5da179fb22543a68293650bd89 | train | tests/test_visitors/test_filenames/test_wrong_module_name/test_module_name_length.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_filenames/test_wrong_module_name/test_module_name_length.py | 35 | 4 | assert_* | test_length_option | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.filenames.wrong_module_name import (
TooShortModuleNameViolation,
WrongModuleNamePatternViolation,
WrongModuleNameVisitor,
)
@pytest.mark.parametrize('filename', [
'a.py',
'some/package/z.py',
'/root/x.py',
'C:/... | [TooShortModuleNameViolation]) | added | ce75e8db3ff0f1dd402c34f45d5b66f4985b2072b3318f9aed3d2d7fc46e3e59 | assert_*|test_length_option|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.filenames.wrong_module_name import ( TooShortModuleNameViolation, WrongModuleNamePatternViolation, WrongModuleNameVisitor, ) @pytest.mark.parametrize('filename', [ 'a.py', 'some/package/z.py', '/root/x.py', 'C:/f.py... | null | null | null |
wemake-services/wemake-python-styleguide | train | 28 | 149e5f382514a93c5b6573433fae07339fe8035d | train | tests/test_visitors/test_ast/test_complexity/test_counts/test_condition_counts.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_complexity/test_counts/test_condition_counts.py | 90 | 4 | assert_* | test_module_condition_counts_violation | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.complexity.counts import (
ConditionsVisitor,
TooManyConditionsViolation,
)
empty_module = ''
condition_with_single_if = """
if 4 > 2 and 3 / 2 == 1.5:
print(1)
"""
condition_with_single_if_multiline = """
if (
some_ca... | [TooManyConditionsViolation]) | added | 0ec40699556d7c26110d156706529d3c8fa672f32320193b0fb9d67655015dfb | assert_*|test_module_condition_counts_violation|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.complexity.counts import ( ConditionsVisitor, TooManyConditionsViolation, ) empty_module = '' condition_with_single_if = """ if 4 > 2 and 3 / 2 == 1.5: print(1) """ condition_with_single_if_m... | null | null | null |
wemake-services/wemake-python-styleguide | train | 28 | 149e5f382514a93c5b6573433fae07339fe8035d | train | tests/test_visitors/test_ast/test_complexity/test_jones/test_line_complexity.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_complexity/test_jones/test_line_complexity.py | 83 | 4 | assert | test_same_complexity | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.complexity.jones import (
JonesComplexityVisitor,
LineComplexityViolation,
)
line_simple = 'x = 2'
line_with_types = 'x: int = 2'
line_with_comprehension = 'x = [f for f in "abc"]'
line_with_math = 'x = y * 2 + 19 / 9.3'
line_in... | len(typed_visitor._lines[1]) | modified | f2f0b97cb90be4faf7623ce2929f10b9f15ba596f1332ccee612bccf9cfb11a1 | assert|test_same_complexity|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.complexity.jones import ( JonesComplexityVisitor, LineComplexityViolation, ) line_simple = 'x = 2' line_with_types = 'x: int = 2' line_with_comprehension = 'x = [f for f in "abc"]' line_with_math = 'x = y * 2 + ... | len(typed_visitor._lines[1]) | 83 | 4 |
wemake-services/wemake-python-styleguide | train | 28 | 149e5f382514a93c5b6573433fae07339fe8035d | train | tests/test_visitors/test_ast/test_complexity/test_offset_visitor.py | test | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_complexity/test_offset_visitor.py | 98 | 4 | assert_* | test_nested_offset_errors | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.complexity.offset import (
OffsetVisitor,
TooDeepNestingViolation,
)
nested_if = """
def container():
if True:
x = 1
"""
nested_if2 = """
def container():
if some_value:
call_other()
"""
nested_for = ""... | errors) | modified | 6ebc46d88049fd56ded42f2caeb8b8d2c6afb12fb2b828f35ce2ea1cf3abad77 | assert_*|test_nested_offset_errors|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.complexity.offset import ( OffsetVisitor, TooDeepNestingViolation, ) nested_if = """ def container(): if True: x = 1 """ nested_if2 = """ def container(): if some_value: call_other() """ nested_for = """ ... | errors) | 98 | 4 |
wemake-services/wemake-python-styleguide | train | 28 | 149e5f382514a93c5b6573433fae07339fe8035d | train | tests/test_visitors/test_ast/test_general/test_wrong_import/test_dotted_raw_import.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_wrong_import/test_dotted_raw_import.py | 33 | 4 | assert_* | test_wrong_dotted_import | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.general.wrong_import import (
DottedRawImportViolation,
WrongImportVisitor,
)
regular_import = 'import {0}'
regular_import_with_alias = 'import {0} as alias'
from_import = 'from {0} import some_module'
from_import_with_alias = '... | [DottedRawImportViolation]) | modified | 4bf983b249bbd588da189f63f1481d359e9be3646a734b95380ec31293e7a38e | assert_*|test_wrong_dotted_import|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.general.wrong_import import ( DottedRawImportViolation, WrongImportVisitor, ) regular_import = 'import {0}' regular_import_with_alias = 'import {0} as alias' from_import = 'from {0} import some_module' fro... | [DottedRawImportViolation]) | 33 | 4 |
wemake-services/wemake-python-styleguide | train | 28 | 149e5f382514a93c5b6573433fae07339fe8035d | train | tests/test_visitors/test_ast/test_general/test_wrong_import/test_relative_imports.py | test | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_wrong_import/test_relative_imports.py | 39 | 4 | assert_* | test_local_folder_import | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.general.wrong_import import (
LocalFolderImportViolation,
WrongImportVisitor,
)
# Wrong:
same_level_relative_import = 'from . import some_thing'
same_level_relative_import_sibling = 'from .some_thing import MyClass'
parent_level... | [LocalFolderImportViolation]) | modified | 01eebcf5da4cba664d14be0c87cc7596fbf2c33853fc4765774e1f82b361cc7c | assert_*|test_local_folder_import|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.general.wrong_import import ( LocalFolderImportViolation, WrongImportVisitor, ) # Wrong: same_level_relative_import = 'from . import some_thing' same_level_relative_import_sibling = 'from .some_thing impor... | [LocalFolderImportViolation]) | 36 | 4 |
wemake-services/wemake-python-styleguide | train | 28 | 149e5f382514a93c5b6573433fae07339fe8035d | train | tests/test_visitors/test_ast/test_general/test_wrong_keyword/test_comprehensions.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_wrong_keyword/test_comprehensions.py | 62 | 4 | assert_* | test_multiple_if_keywords_in_comprehension | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.general.wrong_keyword import (
MultipleIfsInComprehensionViolation,
WrongListComprehensionVisitor,
)
ifs_multiple = """
nodes = [node for node in 'abc' if node != 'a' if node != 'b' if node != 'c']
"""
ifs_twice = """
nodes = [... | [MultipleIfsInComprehensionViolation]) | added | 40d36962c21f6268ceac9e8c72114f86ddf6d9eb0b9212ff65bee95a4deb9904 | assert_*|test_multiple_if_keywords_in_comprehension|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.general.wrong_keyword import ( MultipleIfsInComprehensionViolation, WrongListComprehensionVisitor, ) ifs_multiple = """ nodes = [node for node in 'abc' if node != 'a' if node != 'b' if no... | null | null | null |
wemake-services/wemake-python-styleguide | train | 28 | 149e5f382514a93c5b6573433fae07339fe8035d | train | tests/test_visitors/test_ast/test_general/test_wrong_keyword/test_del.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_wrong_keyword/test_del.py | 32 | 4 | assert_* | test_del_keyword | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.general.wrong_keyword import (
WrongKeywordViolation,
WrongKeywordVisitor,
)
del_variable = """
x = 5
del x
"""
del_key = """
temp_dict = {'a': 1}
del a['a']
"""
@pytest.mark.parametrize('code', [
del_variable,
del_ke... | [WrongKeywordViolation]) | added | e13ac2a5a0e0941a1f02782ac374b080f1a49d755bc8a85d947488b0aebad3be | assert_*|test_del_keyword|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.general.wrong_keyword import ( WrongKeywordViolation, WrongKeywordVisitor, ) del_variable = """ x = 5 del x """ del_key = """ temp_dict = {'a': 1} del a['a'] """ @pytest.mark.parametrize('code', [ del_variable, de... | null | null | null |
wemake-services/wemake-python-styleguide | train | 28 | 149e5f382514a93c5b6573433fae07339fe8035d | train | tests/test_visitors/test_ast/test_general/test_wrong_name/test_variable_names.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_wrong_name/test_variable_names.py | 119 | 4 | assert_* | test_private_variable_names | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.visitors.ast.general.wrong_name import (
BAD_VARIABLE_NAMES,
PrivateNameViolation,
TooShortVariableNameViolation,
WrongNameVisitor,
WrongVariableNameViolation,
)
variable_test = """
{0} = 'test'
"""
underscore_var... | [PrivateNameViolation]) | modified | 37e57dc9972e84a2ceade81962e3f4041fb6b06b56afd9b3f953d0062eeb2822 | assert_*|test_private_variable_names|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.visitors.ast.general.wrong_name import ( BAD_VARIABLE_NAMES, PrivateNameViolation, TooShortVariableNameViolation, WrongNameVisitor, WrongVariableNameViolation, ) variable_test = """ {0} = 'test' """ un... | [PrivateNameViolation]) | 119 | 4 |
wemake-services/wemake-python-styleguide | train | 29 | ed9a819a97adbff67569fab9a2651325645816e4 | train | tests/test_visitors/test_tokenize/test_wrong_primitives/test_partial_floats.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_tokenize/test_wrong_primitives/test_partial_floats.py | 28 | 4 | assert_* | test_partial_float | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.tokenize.wrong_primitives import (
PartialFloatViolation,
WrongPrimitivesVisitor,
)
@pytest.mark.parametrize('code', [
'x = 10.',
'print(3. + 5.1)',
'.05 + 1.2',
])
def test_partial_float(
parse_tokens,
assert_e... | [PartialFloatViolation]) | added | 5a1a48b7f74d6d9e574397d249b7adba578e4366bf7f7517d8be07e9620d933a | assert_*|test_partial_float|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.tokenize.wrong_primitives import ( PartialFloatViolation, WrongPrimitivesVisitor, ) @pytest.mark.parametrize('code', [ 'x = 10.', 'print(3. + 5.1)', '.05 + 1.2', ]) def test_partial_float( parse_tokens, assert_error... | null | null | null |
wemake-services/wemake-python-styleguide | train | 30 | d5829c432babce912907d556e9471114623fb8c6 | train | tests/test_errors.py | test | wemake-services/wemake-python-styleguide:tests/test_errors.py | 30 | 4 | assert | test_all_unique_error_codes | # -*- coding: utf-8 -*-
import ast
from wemake_python_styleguide.errors.base import (
ASTStyleViolation,
BaseStyleViolation,
)
def test_visitor_returns_location():
"""Ensures that `BaseNodeVisitor` return correct error message."""
visitor = ASTStyleViolation(node=ast.parse(''), text='error')
vis... | len(all_errors) | modified | b79664cfca3bb86cb891cd10bc5d4bda030ac004a5e39679e97193ba00b14e12 | assert|test_all_unique_error_codes|# -*- coding: utf-8 -*- import ast from wemake_python_styleguide.errors.base import ( ASTStyleViolation, BaseStyleViolation, ) def test_visitor_returns_location(): """Ensures that `BaseNodeVisitor` return correct error message.""" visitor = ASTStyleViolation(node=ast.parse(''), text='... | len(all_errors) | 30 | 4 |
wemake-services/wemake-python-styleguide | train | 30 | d5829c432babce912907d556e9471114623fb8c6 | train | tests/test_errors.py | test | wemake-services/wemake-python-styleguide:tests/test_errors.py | 36 | 8 | assert | test_all_errors_have_description_with_code | # -*- coding: utf-8 -*-
import ast
from wemake_python_styleguide.errors.base import (
ASTStyleViolation,
BaseStyleViolation,
)
def test_visitor_returns_location():
"""Ensures that `BaseNodeVisitor` return correct error message."""
visitor = ASTStyleViolation(node=ast.parse(''), text='error')
vis... | error.__doc__ | modified | 25e2612a78e390a0ae5261a2df89418154ad28aef13b29020f87fcf44ec4a742 | assert|test_all_errors_have_description_with_code|# -*- coding: utf-8 -*- import ast from wemake_python_styleguide.errors.base import ( ASTStyleViolation, BaseStyleViolation, ) def test_visitor_returns_location(): """Ensures that `BaseNodeVisitor` return correct error message.""" visitor = ASTStyleViolation(node=ast.pa... | error.__doc__ | 36 | 8 |
wemake-services/wemake-python-styleguide | train | 30 | d5829c432babce912907d556e9471114623fb8c6 | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 24 | 12 | assert | # -*- coding: utf-8 -*-
from collections import namedtuple
from typing import Sequence
import pytest
from wemake_python_styleguide.options.config import Configuration
from wemake_python_styleguide.visitors.base import BaseVisitor
def _to_dest_option(long_option_name: str) -> str:
return long_option_name[2:].re... | errors[index].code | modified | e3bb5efd70816a474d87d5585e31fa7d2185b0ccdccb34dc4a78f153b496cb3e | assert||# -*- coding: utf-8 -*- from collections import namedtuple from typing import Sequence import pytest from wemake_python_styleguide.options.config import Configuration from wemake_python_styleguide.visitors.base import BaseVisitor def _to_dest_option(long_option_name: str) -> str: return long_option_name[2:].rep... | errors[index].code | 22 | 12 | |
wemake-services/wemake-python-styleguide | train | 30 | d5829c432babce912907d556e9471114623fb8c6 | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 26 | 8 | assert | # -*- coding: utf-8 -*-
from collections import namedtuple
from typing import Sequence
import pytest
from wemake_python_styleguide.options.config import Configuration
from wemake_python_styleguide.visitors.base import BaseVisitor
def _to_dest_option(long_option_name: str) -> str:
return long_option_name[2:].re... | len(errors) | modified | eea58576ced02aa2d6c6400b0fa740c0138dcf4137c75d845ad77f5401b7feba | assert||# -*- coding: utf-8 -*- from collections import namedtuple from typing import Sequence import pytest from wemake_python_styleguide.options.config import Configuration from wemake_python_styleguide.visitors.base import BaseVisitor def _to_dest_option(long_option_name: str) -> str: return long_option_name[2:].rep... | len(errors) | 24 | 8 | |
wemake-services/wemake-python-styleguide | train | 30 | d5829c432babce912907d556e9471114623fb8c6 | train | tests/test_visitors/test_ast/test_complexity/test_magic_numbers.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_complexity/test_magic_numbers.py | 136 | 4 | assert_* | test_magic_number_warning | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.complexity.numbers import (
MAGIC_NUMBERS_WHITELIST,
MagicNumberViolation,
MagicNumberVisitor,
)
# Correct usages:
assignment = 'constant = {0}'
assignment_unary = 'constant = -{0}'
function_definition = """
def function_n... | [MagicNumberViolation]) | added | 488c30be90433856649f5c90cdff5aecaf9b8443c2836aab3e245ea661c1282b | assert_*|test_magic_number_warning|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.complexity.numbers import ( MAGIC_NUMBERS_WHITELIST, MagicNumberViolation, MagicNumberVisitor, ) # Correct usages: assignment = 'constant = {0}' assignment_unary = 'constant = -{0}' function_definition = ... | null | null | null |
wemake-services/wemake-python-styleguide | train | 30 | d5829c432babce912907d556e9471114623fb8c6 | train | tests/test_visitors/test_ast/test_general/test_wrong_keyword/test_comprehensions.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_wrong_keyword/test_comprehensions.py | 130 | 4 | assert_* | test_multiple_if_keywords_in_comprehension | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.general.wrong_keyword import (
MultipleIfsInComprehensionViolation,
WrongListComprehensionVisitor,
)
# Lists:
list_ifs_multiple = """
nodes = [node for node in 'abc' if node != 'a' if node != 'b' if node != 'c']
"""
list_ifs_t... | [MultipleIfsInComprehensionViolation]) | added | 6618685f0eee68dd710ec9592d491c267a3c98dcb053e42bd1ee72fdb3d973ca | assert_*|test_multiple_if_keywords_in_comprehension|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.general.wrong_keyword import ( MultipleIfsInComprehensionViolation, WrongListComprehensionVisitor, ) # Lists: list_ifs_multiple = """ nodes = [node for node in 'abc' if node != 'a' if nod... | null | null | null |
wemake-services/wemake-python-styleguide | train | 30 | d5829c432babce912907d556e9471114623fb8c6 | train | tests/test_visitors/test_tokenize/test_wrong_primitives/test_partial_floats.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_tokenize/test_wrong_primitives/test_partial_floats.py | 29 | 4 | assert_* | test_partial_float | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.tokenize.wrong_primitives import (
PartialFloatViolation,
WrongPrimitivesVisitor,
)
@pytest.mark.parametrize('code', [
'x = 10.',
'print(3. + 5.1)',
'.05 + 1.2',
'words: int = 12.',
])
def test_partial_float(
pa... | [PartialFloatViolation]) | modified | 4b0d323dcf6958da2a0b3a10b14ca5e549662ac34eb0557bafe0418060a52284 | assert_*|test_partial_float|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.tokenize.wrong_primitives import ( PartialFloatViolation, WrongPrimitivesVisitor, ) @pytest.mark.parametrize('code', [ 'x = 10.', 'print(3. + 5.1)', '.05 + 1.2', 'words: int = 12.', ]) def test_partial_float( parse_... | [PartialFloatViolation]) | 28 | 4 |
wemake-services/wemake-python-styleguide | train | 30 | d5829c432babce912907d556e9471114623fb8c6 | train | tests/test_visitors/test_tokenize/test_wrong_primitives/test_unicode_prefix.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_tokenize/test_wrong_primitives/test_unicode_prefix.py | 29 | 4 | assert_* | test_unicode_prefix | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.tokenize.wrong_primitives import (
UnicodeStringViolation,
WrongPrimitivesVisitor,
)
@pytest.mark.parametrize('code', [
'x = u"text"',
"print(u'unicode')",
'"3_3" + u"5_5"',
'u""',
])
def test_unicode_prefix(
pa... | [UnicodeStringViolation]) | modified | 353f23613cd67931a68b2f305445435e8cf37d21fa91d211d7825ad811999dd6 | assert_*|test_unicode_prefix|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.tokenize.wrong_primitives import ( UnicodeStringViolation, WrongPrimitivesVisitor, ) @pytest.mark.parametrize('code', [ 'x = u"text"', "print(u'unicode')", '"3_3" + u"5_5"', 'u""', ]) def test_unicode_prefix( parse... | [UnicodeStringViolation]) | 28 | 4 |
wemake-services/wemake-python-styleguide | train | 31 | 9682f0a3976852d66998a164759a60553fd62ffb | train | tests/fixtures/external_plugins.py | train | wemake-services/wemake-python-styleguide:tests/fixtures/external_plugins.py | 20 | 0 | assert | from sys import *
import sys
int = 12
++int
some_list = list((node for node in 'abc'))
some_tuple = (1, 2, )
braking_pycodestyle=3
# commented: str = 'comment'
def camelCase(): ...
'{}'.format(1)
""
'%s' % 'test'
assert | True | added | 119b64a610d4609caaa79c0452f3efcaee7bbb931ff6e655520e5e124b42122b | assert||from sys import * import sys int = 12 ++int some_list = list((node for node in 'abc')) some_tuple = (1, 2, ) braking_pycodestyle=3 # commented: str = 'comment' def camelCase(): ... '{}'.format(1) "" '%s' % 'test' assert | null | null | null | |
wemake-services/wemake-python-styleguide | train | 32 | 193835dded08ef0cc169172f489101199222fbe3 | train | tests/test_visitors/test_tokenize/test_wrong_comments/test_typed_ast.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_tokenize/test_wrong_comments/test_typed_ast.py | 59 | 4 | assert_* | test_incorrect_type_comment | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.tokenize.wrong_comments import (
WrongCommentVisitor,
WrongMagicCommentViolation,
)
@pytest.mark.parametrize('code', [
'1 + "12" # type: ignore',
'1 + "12" # type:ignore',
'total = 1000 # type is not clear',
'pri... | [WrongMagicCommentViolation]) | added | 162ae21e7d4ea9fbf03b62e8b79036f9dc92b042b66783ed88ac1504cb36f8bb | assert_*|test_incorrect_type_comment|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.tokenize.wrong_comments import ( WrongCommentVisitor, WrongMagicCommentViolation, ) @pytest.mark.parametrize('code', [ '1 + "12" # type: ignore', '1 + "12" # type:ignore', 'total = 1000 # type is not clear'... | null | null | null |
wemake-services/wemake-python-styleguide | train | 32 | 193835dded08ef0cc169172f489101199222fbe3 | train | tests/test_visitors/test_tokenize/test_wrong_comments/test_wrong_doc_comment.py | test | wemake-services/wemake-python-styleguide:tests/test_visitors/test_tokenize/test_wrong_comments/test_wrong_doc_comment.py | 68 | 4 | assert_* | test_incorrect_doc_comment | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.tokenize.wrong_comments import (
WrongCommentVisitor,
WrongDocCommentViolation,
)
constant_doc = """
#: {0}
SOME_CONSTANT = 12
"""
attribute_doc = """
class SomeClass(object):
#: {0}
some_field = 'text'
"""
@pytest.mark.p... | [WrongDocCommentViolation]) | added | f1375e6a1d9adc9f25660aeb6a4fd83e9d2be61ec2ede9eb55123ad8db993ac8 | assert_*|test_incorrect_doc_comment|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.tokenize.wrong_comments import ( WrongCommentVisitor, WrongDocCommentViolation, ) constant_doc = """ #: {0} SOME_CONSTANT = 12 """ attribute_doc = """ class SomeClass(object): #: {0} some_field = 'text' """ ... | null | null | null |
wemake-services/wemake-python-styleguide | train | 34 | cc252bc0363f1e4936c2560bb402e992a075363d | train | tests/test_visitors/test_ast/test_complexity/test_magic_numbers.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_complexity/test_magic_numbers.py | 136 | 4 | assert_* | test_magic_number_warning | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.errors.best_practices import MagicNumberViolation
from wemake_python_styleguide.visitors.ast.complexity.numbers import (
MAGIC_NUMBERS_WHITELIST,
MagicNumberVisitor,
)
# Correct usages:
assignment = 'constant = {0}'
assignment_unary = 'cons... | [MagicNumberViolation]) | modified | 4875637096e3b683bf60dd08078ef520e9ddb4946000bfde97ae43372b8afb25 | assert_*|test_magic_number_warning|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.errors.best_practices import MagicNumberViolation from wemake_python_styleguide.visitors.ast.complexity.numbers import ( MAGIC_NUMBERS_WHITELIST, MagicNumberVisitor, ) # Correct usages: assignment = 'constant = {0}' a... | [MagicNumberViolation]) | 136 | 4 |
wemake-services/wemake-python-styleguide | train | 34 | cc252bc0363f1e4936c2560bb402e992a075363d | train | tests/test_visitors/test_ast/test_general/test_wrong_function_call/test_wrong_function_calls.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_wrong_function_call/test_wrong_function_calls.py | 37 | 4 | assert_* | test_wrong_function_called | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.errors.best_practices import (
WrongFunctionCallViolation,
)
from wemake_python_styleguide.visitors.ast.general.wrong_function_call import (
BAD_FUNCTIONS,
WrongFunctionCallVisitor,
)
regular_call = '{0}(*args, **kwargs)'
assignment_call... | [WrongFunctionCallViolation]) | modified | 259ee21e6090fc27ebf878a6d911299ed98c856871f86e70d7e2c53a3bca5423 | assert_*|test_wrong_function_called|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.errors.best_practices import ( WrongFunctionCallViolation, ) from wemake_python_styleguide.visitors.ast.general.wrong_function_call import ( BAD_FUNCTIONS, WrongFunctionCallVisitor, ) regular_call = '{0}(*args, **kwa... | [WrongFunctionCallViolation]) | 35 | 4 |
wemake-services/wemake-python-styleguide | train | 34 | cc252bc0363f1e4936c2560bb402e992a075363d | train | tests/test_visitors/test_ast/test_general/test_wrong_module/test_empty_init.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_wrong_module/test_empty_init.py | 74 | 4 | assert_* | test_init_with_logic | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.errors.best_practices import (
InitModuleHasLogicViolation,
)
from wemake_python_styleguide.visitors.ast.general.wrong_module import (
WrongContentsVisitor,
)
empty_module = ''
module_with_docstring = """
'''Hi, am a docstring inside a modul... | [InitModuleHasLogicViolation]) | modified | 7b76b38f97f7db548b6a59375c44aaca068c001234e4dcf5cb49a2e0d75c6d48 | assert_*|test_init_with_logic|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.errors.best_practices import ( InitModuleHasLogicViolation, ) from wemake_python_styleguide.visitors.ast.general.wrong_module import ( WrongContentsVisitor, ) empty_module = '' module_with_docstring = """ '''Hi, am a docst... | [InitModuleHasLogicViolation]) | 72 | 4 |
wemake-services/wemake-python-styleguide | train | 34 | cc252bc0363f1e4936c2560bb402e992a075363d | train | tests/test_visitors/test_ast/test_general/test_wrong_module/test_empty_modules.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_wrong_module/test_empty_modules.py | 28 | 4 | assert_* | test_simple_filename | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.errors.best_practices import EmptyModuleViolation
from wemake_python_styleguide.visitors.ast.general.wrong_module import (
WrongContentsVisitor,
)
@pytest.mark.parametrize('filename', [
'empty.py',
'/home/user/logics.py',
'partial/v... | [EmptyModuleViolation]) | modified | c50eb14a02965c58ceeca960d6888727a0bc1541423528d7a1fbfc53ddc151fb | assert_*|test_simple_filename|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.errors.best_practices import EmptyModuleViolation from wemake_python_styleguide.visitors.ast.general.wrong_module import ( WrongContentsVisitor, ) @pytest.mark.parametrize('filename', [ 'empty.py', '/home/user/logics.py', ... | [EmptyModuleViolation]) | 28 | 4 |
wemake-services/wemake-python-styleguide | train | 34 | cc252bc0363f1e4936c2560bb402e992a075363d | train | tests/test_visitors/test_ast/test_general/test_wrong_name/test_function_args_names.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_wrong_name/test_function_args_names.py | 110 | 4 | assert_* | test_private_function_arguments | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.errors.naming import (
PrivateNameViolation,
TooShortVariableNameViolation,
WrongVariableNameViolation,
)
from wemake_python_styleguide.visitors.ast.general.wrong_name import (
BAD_VARIABLE_NAMES,
WrongNameVisitor,
... | [ PrivateNameViolation, PrivateNameViolation, ]) | modified | be75c1f59ddb66a55ab5ab3f5cd5fd0fbacac7bff4dd0a83e243a93f0a1bd0a2 | assert_*|test_private_function_arguments|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.errors.naming import ( PrivateNameViolation, TooShortVariableNameViolation, WrongVariableNameViolation, ) from wemake_python_styleguide.visitors.ast.general.wrong_name import ( BAD_VARIABLE_NAMES, ... | [ PrivateNameViolation, PrivateNameViolation, ]) | 108 | 4 |
wemake-services/wemake-python-styleguide | train | 34 | cc252bc0363f1e4936c2560bb402e992a075363d | train | tests/test_visitors/test_ast/test_general/test_wrong_name/test_variable_names.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_wrong_name/test_variable_names.py | 65 | 4 | assert_* | test_wrong_variable_names | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.errors.naming import (
PrivateNameViolation,
TooShortVariableNameViolation,
WrongVariableNameViolation,
)
from wemake_python_styleguide.visitors.ast.general.wrong_name import (
BAD_VARIABLE_NAMES,
WrongNameVisitor,
... | [WrongVariableNameViolation]) | modified | 5f72ceae57edf0f0fb52bc393e66e2b6363b9ff31b87584d4cf579ebca93ad25 | assert_*|test_wrong_variable_names|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.errors.naming import ( PrivateNameViolation, TooShortVariableNameViolation, WrongVariableNameViolation, ) from wemake_python_styleguide.visitors.ast.general.wrong_name import ( BAD_VARIABLE_NAMES, WrongN... | [WrongVariableNameViolation]) | 63 | 4 |
wemake-services/wemake-python-styleguide | train | 34 | cc252bc0363f1e4936c2560bb402e992a075363d | train | tests/test_visitors/test_ast/test_wrong_class/test_magic_methods.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_wrong_class/test_magic_methods.py | 27 | 4 | assert_* | test_wrong_magic_used | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.constants import BAD_MAGIC_METHODS
from wemake_python_styleguide.errors.best_practices import (
BadMagicMethodViolation,
)
from wemake_python_styleguide.visitors.ast.wrong_class import WrongClassVisitor
magic_method = """
class Example(object):
... | [BadMagicMethodViolation]) | added | a3456ccb0e278c304432fbfcb0be4720ce4cdfbdfbaec7bd74a3a237d5c692d8 | assert_*|test_wrong_magic_used|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.constants import BAD_MAGIC_METHODS from wemake_python_styleguide.errors.best_practices import ( BadMagicMethodViolation, ) from wemake_python_styleguide.visitors.ast.wrong_class import WrongClassVisitor magic_method = """... | null | null | null |
wemake-services/wemake-python-styleguide | train | 34 | cc252bc0363f1e4936c2560bb402e992a075363d | train | tests/test_visitors/test_tokenize/test_wrong_comments/test_noqa_comment.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_tokenize/test_wrong_comments/test_noqa_comment.py | 63 | 4 | assert_* | test_incorrect_noqa_comment | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.errors.best_practices import (
WrongMagicCommentViolation,
)
from wemake_python_styleguide.visitors.tokenize.wrong_comments import (
WrongCommentVisitor,
)
@pytest.mark.parametrize('code', [
'x = 10_00 # noqa: Z002,Z114',
'x = 10_0... | [WrongMagicCommentViolation]) | modified | 030d9147d4cddd16e2042c47f5d4c226afbba8e99d4f4521c8dcdda1f7f171e1 | assert_*|test_incorrect_noqa_comment|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.errors.best_practices import ( WrongMagicCommentViolation, ) from wemake_python_styleguide.visitors.tokenize.wrong_comments import ( WrongCommentVisitor, ) @pytest.mark.parametrize('code', [ 'x = 10_00 # noqa: Z002,... | [WrongMagicCommentViolation]) | 61 | 4 |
wemake-services/wemake-python-styleguide | train | 35 | d1c8691f4f4ac62827764c86f7624ae66c8acb21 | train | tests/test_errors.py | test | wemake-services/wemake-python-styleguide:tests/test_errors.py | 49 | 4 | assert | test_all_unique_error_codes | # -*- coding: utf-8 -*-
import ast
from wemake_python_styleguide.errors.base import (
ASTStyleViolation,
BaseStyleViolation,
)
def test_visitor_returns_location():
"""Ensures that `BaseNodeVisitor` return correct error message."""
visitor = ASTStyleViolation(node=ast.parse(''), text='error')
vis... | len(all_errors) | modified | 2cd238bdb88a38148fe0d423efd29708351b38fe7d3a63585d3b766decef2a3d | assert|test_all_unique_error_codes|# -*- coding: utf-8 -*- import ast from wemake_python_styleguide.errors.base import ( ASTStyleViolation, BaseStyleViolation, ) def test_visitor_returns_location(): """Ensures that `BaseNodeVisitor` return correct error message.""" visitor = ASTStyleViolation(node=ast.parse(''), text='... | len(all_errors) | 49 | 4 |
wemake-services/wemake-python-styleguide | train | 35 | d1c8691f4f4ac62827764c86f7624ae66c8acb21 | train | tests/test_errors.py | test | wemake-services/wemake-python-styleguide:tests/test_errors.py | 55 | 8 | assert | test_all_errors_have_description_with_code | # -*- coding: utf-8 -*-
import ast
from wemake_python_styleguide.errors.base import (
ASTStyleViolation,
BaseStyleViolation,
)
def test_visitor_returns_location():
"""Ensures that `BaseNodeVisitor` return correct error message."""
visitor = ASTStyleViolation(node=ast.parse(''), text='error')
vis... | error.__doc__ | modified | c9f66f1cdd354668d9b7dbe202dde850fbd4570344e0342b6a439e88c598029d | assert|test_all_errors_have_description_with_code|# -*- coding: utf-8 -*- import ast from wemake_python_styleguide.errors.base import ( ASTStyleViolation, BaseStyleViolation, ) def test_visitor_returns_location(): """Ensures that `BaseNodeVisitor` return correct error message.""" visitor = ASTStyleViolation(node=ast.pa... | error.__doc__ | 55 | 8 |
wemake-services/wemake-python-styleguide | train | 35 | d1c8691f4f4ac62827764c86f7624ae66c8acb21 | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 24 | 12 | assert | # -*- coding: utf-8 -*-
from collections import namedtuple
from typing import Sequence
import pytest
from wemake_python_styleguide.options.config import Configuration
from wemake_python_styleguide.visitors.base import BaseVisitor
def _to_dest_option(long_option_name: str) -> str:
return long_option_name[2:].re... | errors[index].code | modified | 596e742189a24bc7d0157374c0db95fbb46dd9bd9919022e5cb24e68f6ed3e56 | assert||# -*- coding: utf-8 -*- from collections import namedtuple from typing import Sequence import pytest from wemake_python_styleguide.options.config import Configuration from wemake_python_styleguide.visitors.base import BaseVisitor def _to_dest_option(long_option_name: str) -> str: return long_option_name[2:].rep... | errors[index].code | 24 | 12 | |
wemake-services/wemake-python-styleguide | train | 35 | d1c8691f4f4ac62827764c86f7624ae66c8acb21 | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 26 | 8 | assert | # -*- coding: utf-8 -*-
from collections import namedtuple
from typing import Sequence
import pytest
from wemake_python_styleguide.options.config import Configuration
from wemake_python_styleguide.visitors.base import BaseVisitor
def _to_dest_option(long_option_name: str) -> str:
return long_option_name[2:].re... | len(errors) | modified | 9433cf209616c9a3a87c9118b45f5ac7ac3ce51d21b36d3f92f6406784c2d460 | assert||# -*- coding: utf-8 -*- from collections import namedtuple from typing import Sequence import pytest from wemake_python_styleguide.options.config import Configuration from wemake_python_styleguide.visitors.base import BaseVisitor def _to_dest_option(long_option_name: str) -> str: return long_option_name[2:].rep... | len(errors) | 26 | 8 | |
wemake-services/wemake-python-styleguide | train | 35 | d1c8691f4f4ac62827764c86f7624ae66c8acb21 | train | tests/test_visitors/test_ast/test_complexity/test_jones/test_line_complexity.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_complexity/test_jones/test_line_complexity.py | 63 | 4 | assert_* | test_complex_lines | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.complexity.jones import (
JonesComplexityVisitor,
LineComplexityViolation,
)
line_simple = 'x = 2'
line_with_types = 'x: int = 2'
line_with_comprehension = 'x = [f for f in "abc"]'
line_with_math = 'x = y * 2 + 19 / 9.3'
line_in... | [LineComplexityViolation]) | modified | c6f65a702d6c1f98dd0e88005a8b8eac2adbd5a03c2970ba65a3ae8b47d4f83f | assert_*|test_complex_lines|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.complexity.jones import ( JonesComplexityVisitor, LineComplexityViolation, ) line_simple = 'x = 2' line_with_types = 'x: int = 2' line_with_comprehension = 'x = [f for f in "abc"]' line_with_math = 'x = y * 2 + ... | [LineComplexityViolation]) | 63 | 4 |
wemake-services/wemake-python-styleguide | train | 35 | d1c8691f4f4ac62827764c86f7624ae66c8acb21 | train | tests/test_visitors/test_ast/test_complexity/test_jones/test_line_complexity.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_complexity/test_jones/test_line_complexity.py | 98 | 4 | assert | test_exact_complexity | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.complexity.jones import (
JonesComplexityVisitor,
LineComplexityViolation,
)
line_simple = 'x = 2'
line_with_types = 'x: int = 2'
line_with_comprehension = 'x = [f for f in "abc"]'
line_with_math = 'x = y * 2 + 19 / 9.3'
line_in... | complexity | modified | 0024b559c0dd6e28d534fe1e873c7e79d8c58d7fdcb2c438374a8e8eca74f6d9 | assert|test_exact_complexity|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.complexity.jones import ( JonesComplexityVisitor, LineComplexityViolation, ) line_simple = 'x = 2' line_with_types = 'x: int = 2' line_with_comprehension = 'x = [f for f in "abc"]' line_with_math = 'x = y * 2 +... | complexity | 98 | 4 |
wemake-services/wemake-python-styleguide | train | 35 | d1c8691f4f4ac62827764c86f7624ae66c8acb21 | train | tests/test_visitors/test_ast/test_complexity/test_jones/test_module_complexity.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_complexity/test_jones/test_module_complexity.py | 43 | 4 | assert_* | test_module_score_error | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.complexity.jones import (
JonesComplexityVisitor,
JonesScoreViolation,
)
module_without_nodes = ''
module_with_nodes = """
some_value = 1 + 2
other = [number for number in range(0, some_value)]
"""
@pytest.mark.parametrize('co... | [JonesScoreViolation]) | modified | 8155bb056032e3ca95cc0eed8e5341cb82d3ea74a2d25e5b0cc719285170a8ab | assert_*|test_module_score_error|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.complexity.jones import ( JonesComplexityVisitor, JonesScoreViolation, ) module_without_nodes = '' module_with_nodes = """ some_value = 1 + 2 other = [number for number in range(0, some_value)] """ @pytest.... | [JonesScoreViolation]) | 43 | 4 |
wemake-services/wemake-python-styleguide | train | 35 | d1c8691f4f4ac62827764c86f7624ae66c8acb21 | train | tests/test_visitors/test_ast/test_general/test_wrong_import/test_nested_imports.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_wrong_import/test_nested_imports.py | 68 | 4 | assert_* | test_nested_import | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.errors.best_practices import NestedImportViolation
from wemake_python_styleguide.visitors.ast.general.wrong_import import (
WrongImportVisitor,
)
# Incorrect imports:
nested_function_import = """
def function():
import os
"""
nested_functi... | [NestedImportViolation]) | modified | 7a39d78a3792649ee47f84c13f1a3a7db5c8b34cca0651ac9d1c23b3b431ff66 | assert_*|test_nested_import|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.errors.best_practices import NestedImportViolation from wemake_python_styleguide.visitors.ast.general.wrong_import import ( WrongImportVisitor, ) # Incorrect imports: nested_function_import = """ def function(): import os ""... | [NestedImportViolation]) | 68 | 4 |
wemake-services/wemake-python-styleguide | train | 36 | d326656f1b77590721a79d17098efe7600ad1966 | train | tests/test_violations.py | train | wemake-services/wemake-python-styleguide:tests/test_violations.py | 55 | 8 | assert | test_all_violations_have_description_with_code | # -*- coding: utf-8 -*-
import ast
from wemake_python_styleguide.violations.base import (
ASTViolation,
BaseStyleViolation,
)
def test_visitor_returns_location():
"""Ensures that `BaseNodeVisitor` return correct violation message."""
visitor = ASTViolation(node=ast.parse(''), text='violation')
v... | violation.__doc__ | added | 4dd81f65a232fae0f2698cb31121dcbddd615054329050f7acd3d93821e78450 | assert|test_all_violations_have_description_with_code|# -*- coding: utf-8 -*- import ast from wemake_python_styleguide.violations.base import ( ASTViolation, BaseStyleViolation, ) def test_visitor_returns_location(): """Ensures that `BaseNodeVisitor` return correct violation message.""" visitor = ASTViolation(node=ast.... | null | null | null |
wemake-services/wemake-python-styleguide | train | 36 | d326656f1b77590721a79d17098efe7600ad1966 | train | tests/test_visitors/test_ast/test_complexity/test_nested/test_nested_functions.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_complexity/test_nested/test_nested_functions.py | 36 | 4 | assert_* | test_nested_function | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
NestedFunctionViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.nested import (
NESTED_FUNCTIONS_WHITELIST,
NestedComplexityVisitor,
)
nested_function = """
def container():
def {0}... | [NestedFunctionViolation]) | modified | e183143f6389f26b49a91e85441f6a245e1b23a5ce80c3186c7108aa3b706051 | assert_*|test_nested_function|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( NestedFunctionViolation, ) from wemake_python_styleguide.visitors.ast.complexity.nested import ( NESTED_FUNCTIONS_WHITELIST, NestedComplexityVisitor, ) nested_function = """ def container... | [NestedFunctionViolation]) | 36 | 4 |
wemake-services/wemake-python-styleguide | train | 36 | d326656f1b77590721a79d17098efe7600ad1966 | train | tests/test_visitors/test_ast/test_general/test_wrong_import/test_dotted_raw_import.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_wrong_import/test_dotted_raw_import.py | 33 | 4 | assert_* | test_wrong_dotted_import | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.consistency import (
DottedRawImportViolation,
)
from wemake_python_styleguide.visitors.ast.imports import WrongImportVisitor
regular_import = 'import {0}'
regular_import_with_alias = 'import {0} as alias'
from_import = 'from {0} impo... | [DottedRawImportViolation]) | modified | 5e6d9953b53c47f5b354e983786de0751589105d9f2d1d0bff31d7dbfb31eac0 | assert_*|test_wrong_dotted_import|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.consistency import ( DottedRawImportViolation, ) from wemake_python_styleguide.visitors.ast.imports import WrongImportVisitor regular_import = 'import {0}' regular_import_with_alias = 'import {0} as alias' f... | [DottedRawImportViolation]) | 33 | 4 |
wemake-services/wemake-python-styleguide | train | 36 | d326656f1b77590721a79d17098efe7600ad1966 | train | tests/test_visitors/test_ast/test_general/test_wrong_name/test_class_attributes.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_wrong_name/test_class_attributes.py | 60 | 4 | assert_* | test_too_short_attribute_names | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.violations.naming import (
PrivateNameViolation,
TooShortVariableNameViolation,
WrongVariableNameViolation,
)
from wemake_python_styleguide.visitors.ast.naming import (
BAD_VARIABLE_NAMES,
WrongNameVisitor,
)
stati... | [TooShortVariableNameViolation]) | modified | 9fa0c18662a237ef84bc7930433126394b2cc0095470446a11b207599c0b54f7 | assert_*|test_too_short_attribute_names|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.violations.naming import ( PrivateNameViolation, TooShortVariableNameViolation, WrongVariableNameViolation, ) from wemake_python_styleguide.visitors.ast.naming import ( BAD_VARIABLE_NAMES, WrongName... | [TooShortVariableNameViolation]) | 60 | 4 |
wemake-services/wemake-python-styleguide | train | 36 | d326656f1b77590721a79d17098efe7600ad1966 | train | tests/test_visitors/test_ast/test_general/test_wrong_name/test_function_names.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_wrong_name/test_function_names.py | 58 | 4 | assert_* | test_too_short_function_names | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.violations.naming import (
PrivateNameViolation,
TooShortVariableNameViolation,
WrongVariableNameViolation,
)
from wemake_python_styleguide.visitors.ast.naming import (
BAD_VARIABLE_NAMES,
WrongNameVisitor,
)
funct... | [TooShortVariableNameViolation]) | modified | 09052aae232a60ce496d40704349c59cbf660096353554c99e590c26dc9c2ef5 | assert_*|test_too_short_function_names|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.violations.naming import ( PrivateNameViolation, TooShortVariableNameViolation, WrongVariableNameViolation, ) from wemake_python_styleguide.visitors.ast.naming import ( BAD_VARIABLE_NAMES, WrongNameV... | [TooShortVariableNameViolation]) | 58 | 4 |
wemake-services/wemake-python-styleguide | train | 36 | d326656f1b77590721a79d17098efe7600ad1966 | train | tests/test_visitors/test_ast/test_general/test_wrong_name/test_module_metadata.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_wrong_name/test_module_metadata.py | 41 | 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 (
BAD_MODULE_METADATA_VARIABLES,
WrongModuleMetadataVisitor,
)
module_metadata = """
{0} = 'Nikita'
"""
nested_m... | [WrongModuleMetadataViolation]) | modified | 72f56fb8d405876df494fb10384202b8d80fc810649539bb1afba9a768e22375 | 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 ( BAD_MODULE_METADATA_VARIABLES, WrongModuleMetadataVisitor, ) module_metadata = """ {0} = 'Nikita'... | [WrongModuleMetadataViolation]) | 41 | 4 |
wemake-services/wemake-python-styleguide | train | 36 | d326656f1b77590721a79d17098efe7600ad1966 | train | tests/test_visitors/test_filenames/test_wrong_module_name/test_module_underscores.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_filenames/test_wrong_module_name/test_module_underscores.py | 36 | 4 | assert_* | test_length_option | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.naming import (
WrongModuleNameUnderscoresViolation,
)
from wemake_python_styleguide.visitors.filenames.wrong_module_name import (
WrongModuleNameVisitor,
)
@pytest.mark.parametrize('filename', [
'some.py',
'my_module.py'... | [WrongModuleNameUnderscoresViolation]) | modified | 1a0fab4a0d9c1406847833188dad21c2483afe686111abb4da7b753c5fb33f89 | assert_*|test_length_option|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.naming import ( WrongModuleNameUnderscoresViolation, ) from wemake_python_styleguide.visitors.filenames.wrong_module_name import ( WrongModuleNameVisitor, ) @pytest.mark.parametrize('filename', [ 'some.py', 'my_mo... | [WrongModuleNameUnderscoresViolation]) | 36 | 4 |
wemake-services/wemake-python-styleguide | train | 36 | d326656f1b77590721a79d17098efe7600ad1966 | train | tests/test_visitors/test_tokenize/test_wrong_primitives/test_underscored_numbers.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_tokenize/test_wrong_primitives/test_underscored_numbers.py | 30 | 4 | assert_* | test_underscored_number | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.consistency import (
UnderscoredNumberViolation,
)
from wemake_python_styleguide.visitors.tokenize.primitives import (
WrongPrimitivesVisitor,
)
@pytest.mark.parametrize('code', [
'x = 10_00',
'print(333_555)',
'3_3 +... | [UnderscoredNumberViolation]) | modified | 3a29d98347815d10e41f01da63a7afe101d85c089372d67a2b48caa00bd1d165 | assert_*|test_underscored_number|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.consistency import ( UnderscoredNumberViolation, ) from wemake_python_styleguide.visitors.tokenize.primitives import ( WrongPrimitivesVisitor, ) @pytest.mark.parametrize('code', [ 'x = 10_00', 'print(333_555)... | [UnderscoredNumberViolation]) | 30 | 4 |
wemake-services/wemake-python-styleguide | train | 37 | 89cc74d01aa46024c4541edc2af20cedbcbecdeb | train | tests/test_visitors/test_ast/test_complexity/test_counts/test_module_counts.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_complexity/test_counts/test_module_counts.py | 63 | 4 | assert_* | test_module_counts_violation | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.complexity.counts import (
ModuleMembersVisitor,
TooManyModuleMembersViolation,
)
module_with_function_and_class = """
def first(): ...
class Second(object): ...
"""
module_with_async_function_and_class = """
async def first()... | [TooManyModuleMembersViolation]) | added | e56433a8af3c5497f4891c4254b92a879b15b0db286fa09cd72927b660752448 | assert_*|test_module_counts_violation|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.complexity.counts import ( ModuleMembersVisitor, TooManyModuleMembersViolation, ) module_with_function_and_class = """ def first(): ... class Second(object): ... """ module_with_async_function_and_clas... | null | null | null |
wemake-services/wemake-python-styleguide | train | 38 | 90ecafdb9ec211a300835806aef2b8d7bf000b8b | train | tests/test_visitors/test_ast/test_complexity/test_counts/test_module_counts.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_complexity/test_counts/test_module_counts.py | 73 | 4 | assert_* | test_module_counts_violation | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.complexity.counts import (
ModuleMembersVisitor,
TooManyModuleMembersViolation,
)
module_with_function_and_class = """
def first(): ...
class Second(object): ...
"""
module_with_async_function_and_class = """
async def first()... | [TooManyModuleMembersViolation]) | added | ee79685f2deb949f6999106ca435c7c6cfc629ee3b38503f503cb055a68a8c1a | assert_*|test_module_counts_violation|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.complexity.counts import ( ModuleMembersVisitor, TooManyModuleMembersViolation, ) module_with_function_and_class = """ def first(): ... class Second(object): ... """ module_with_async_function_and_clas... | null | null | null |
wemake-services/wemake-python-styleguide | train | 39 | 0f1387811b08b102806e653ebd9f50d1ec7d2529 | train | tests/test_visitors/test_ast/test_general/test_wrong_keyword/test_comprehensions.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_wrong_keyword/test_comprehensions.py | 168 | 4 | assert_* | test_multiple_if_keywords_in_comprehension | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.consistency import (
MultipleIfsInComprehensionViolation,
)
from wemake_python_styleguide.visitors.ast.keywords import (
WrongListComprehensionVisitor,
)
# Lists:
async_wrapper = """
async def f():
{comprehension}
"""
list_if... | [MultipleIfsInComprehensionViolation]) | added | 2d938289769909fa431f5be49a6d69cea260e1fa5abace3d96c1929581886c45 | assert_*|test_multiple_if_keywords_in_comprehension|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.consistency import ( MultipleIfsInComprehensionViolation, ) from wemake_python_styleguide.visitors.ast.keywords import ( WrongListComprehensionVisitor, ) # Lists: async_wrapper = """ async ... | null | null | null |
wemake-services/wemake-python-styleguide | train | 40 | eea9beeab91e00b42e546f1afd7813d94d961c09 | train | tests/test_visitors/test_ast/test_general/test_wrong_keyword/test_comprehensions.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_wrong_keyword/test_comprehensions.py | 128 | 4 | assert_* | test_multiple_if_keywords_in_comprehension | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.consistency import (
MultipleIfsInComprehensionViolation,
)
from wemake_python_styleguide.visitors.ast.keywords import (
WrongListComprehensionVisitor,
)
# Lists:
list_ifs_multiple = """
nodes = [node for node in "abc" if node !=... | [MultipleIfsInComprehensionViolation]) | added | 692440fc9050d37bec4a34a743762c552dbc41dbd3e93041bea0a1a0b14c7521 | assert_*|test_multiple_if_keywords_in_comprehension|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.consistency import ( MultipleIfsInComprehensionViolation, ) from wemake_python_styleguide.visitors.ast.keywords import ( WrongListComprehensionVisitor, ) # Lists: list_ifs_multiple = """ no... | null | null | null |
wemake-services/wemake-python-styleguide | train | 41 | 33fb625e2dac3ee1d8d6da969f5e4ea822354d6e | train | tests/test_visitors/test_ast/test_complexity/test_counts/test_method_counts.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_complexity/test_counts/test_method_counts.py | 118 | 4 | assert_* | test_method_counts_violation | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.complexity.counts import (
MethodMembersVisitor,
TooManyMethodsViolation,
)
module_without_methods = """
def first(): ...
def second(): ...
"""
module_without_methods_with_async_functions = """
async def first(): ...
async de... | [TooManyMethodsViolation]) | added | e81215558b9fdba0c117c4a63c5cb14dbf7eaf9366384ee0118b6a290e56c753 | assert_*|test_method_counts_violation|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.complexity.counts import ( MethodMembersVisitor, TooManyMethodsViolation, ) module_without_methods = """ def first(): ... def second(): ... """ module_without_methods_with_async_functions = """ async d... | null | null | null |
wemake-services/wemake-python-styleguide | train | 42 | 61664f04b3cfef7373adedd023422e90816424c5 | train | tests/test_visitors/test_ast/test_complexity/test_offset_visitor.py | test | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_complexity/test_offset_visitor.py | 124 | 4 | assert_* | test_nested_offset_errors | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.complexity.offset import (
OffsetVisitor,
TooDeepNestingViolation,
)
nested_if = """
def container():
if True:
x = 1
"""
nested_if2 = """
def container():
if some_value:
call_other()
"""
nested_for = ""... | errors) | added | 4f221e6b7fc44507898d81edd2f4f756b584db1f81357a26fb0eaaf1d343ed58 | assert_*|test_nested_offset_errors|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.complexity.offset import ( OffsetVisitor, TooDeepNestingViolation, ) nested_if = """ def container(): if True: x = 1 """ nested_if2 = """ def container(): if some_value: call_other() """ nested_for = """ ... | null | null | null |
wemake-services/wemake-python-styleguide | train | 43 | 61ee0b4cf653ba0839ee3bd5502a3ffd482dfcc8 | train | tests/test_visitors/test_ast/test_general/test_wrong_name/test_function_names.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_wrong_name/test_function_names.py | 46 | 4 | assert_* | test_wrong_function_names | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.violations.naming import (
PrivateNameViolation,
TooShortVariableNameViolation,
WrongVariableNameViolation,
)
from wemake_python_styleguide.visitors.ast.naming import (
BAD_VARIABLE_NAMES,
WrongNameVisitor,
)
funct... | [WrongVariableNameViolation]) | added | d96195882bd0fadd9568eedf1a71e0c6cab020820ea4d134bad5a731792dfd53 | assert_*|test_wrong_function_names|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.violations.naming import ( PrivateNameViolation, TooShortVariableNameViolation, WrongVariableNameViolation, ) from wemake_python_styleguide.visitors.ast.naming import ( BAD_VARIABLE_NAMES, WrongNameVisit... | null | null | null |
wemake-services/wemake-python-styleguide | train | 43 | 61ee0b4cf653ba0839ee3bd5502a3ffd482dfcc8 | train | tests/test_visitors/test_ast/test_general/test_wrong_name/test_function_names.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_wrong_name/test_function_names.py | 64 | 4 | assert_* | test_too_short_function_names | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.violations.naming import (
PrivateNameViolation,
TooShortVariableNameViolation,
WrongVariableNameViolation,
)
from wemake_python_styleguide.visitors.ast.naming import (
BAD_VARIABLE_NAMES,
WrongNameVisitor,
)
funct... | [TooShortVariableNameViolation]) | added | 09967340ef67d428953356411b3ba94b5b28ab408d059770d23122d8f87db56c | assert_*|test_too_short_function_names|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.violations.naming import ( PrivateNameViolation, TooShortVariableNameViolation, WrongVariableNameViolation, ) from wemake_python_styleguide.visitors.ast.naming import ( BAD_VARIABLE_NAMES, WrongNameV... | null | null | null |
wemake-services/wemake-python-styleguide | train | 43 | 61ee0b4cf653ba0839ee3bd5502a3ffd482dfcc8 | train | tests/test_visitors/test_ast/test_general/test_wrong_name/test_function_names.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_wrong_name/test_function_names.py | 81 | 4 | assert_* | test_private_function_names | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.violations.naming import (
PrivateNameViolation,
TooShortVariableNameViolation,
WrongVariableNameViolation,
)
from wemake_python_styleguide.visitors.ast.naming import (
BAD_VARIABLE_NAMES,
WrongNameVisitor,
)
funct... | [PrivateNameViolation]) | added | 519eab5d78dd5df433d6dbb06304db879f502617b22d927392d869f9ca51fb2f | assert_*|test_private_function_names|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.violations.naming import ( PrivateNameViolation, TooShortVariableNameViolation, WrongVariableNameViolation, ) from wemake_python_styleguide.visitors.ast.naming import ( BAD_VARIABLE_NAMES, WrongNameVis... | null | null | null |
wemake-services/wemake-python-styleguide | train | 43 | 61ee0b4cf653ba0839ee3bd5502a3ffd482dfcc8 | train | tests/test_visitors/test_ast/test_general/test_wrong_name/test_variable_names.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_wrong_name/test_variable_names.py | 79 | 4 | assert_* | test_wrong_variable_names | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.violations.naming import (
PrivateNameViolation,
TooShortVariableNameViolation,
WrongVariableNameViolation,
)
from wemake_python_styleguide.visitors.ast.naming import (
BAD_VARIABLE_NAMES,
WrongNameVisitor,
)
varia... | [WrongVariableNameViolation]) | added | 2faae24efe6927bd4d5b512dd81c22382bc27da28b011a1ba0ddf9fd23835aa5 | assert_*|test_wrong_variable_names|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.violations.naming import ( PrivateNameViolation, TooShortVariableNameViolation, WrongVariableNameViolation, ) from wemake_python_styleguide.visitors.ast.naming import ( BAD_VARIABLE_NAMES, WrongNameVisit... | null | null | null |
wemake-services/wemake-python-styleguide | train | 43 | 61ee0b4cf653ba0839ee3bd5502a3ffd482dfcc8 | train | tests/test_visitors/test_ast/test_general/test_wrong_name/test_variable_names.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_wrong_name/test_variable_names.py | 100 | 4 | assert_* | test_too_short_variable_names | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.violations.naming import (
PrivateNameViolation,
TooShortVariableNameViolation,
WrongVariableNameViolation,
)
from wemake_python_styleguide.visitors.ast.naming import (
BAD_VARIABLE_NAMES,
WrongNameVisitor,
)
varia... | [TooShortVariableNameViolation]) | added | 1f31a3ec88dd061b564cb354d1dfeed70a9d43e682dcfd11e63e9033ecf4785e | assert_*|test_too_short_variable_names|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.violations.naming import ( PrivateNameViolation, TooShortVariableNameViolation, WrongVariableNameViolation, ) from wemake_python_styleguide.visitors.ast.naming import ( BAD_VARIABLE_NAMES, WrongNameV... | null | null | null |
wemake-services/wemake-python-styleguide | train | 43 | 61ee0b4cf653ba0839ee3bd5502a3ffd482dfcc8 | train | tests/test_visitors/test_ast/test_general/test_wrong_name/test_variable_names.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_wrong_name/test_variable_names.py | 121 | 4 | assert_* | test_too_short_variable_names_configured | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.violations.naming import (
PrivateNameViolation,
TooShortVariableNameViolation,
WrongVariableNameViolation,
)
from wemake_python_styleguide.visitors.ast.naming import (
BAD_VARIABLE_NAMES,
WrongNameVisitor,
)
varia... | [TooShortVariableNameViolation]) | added | e9675e1017c0fa22b113f20645385af86e36517b66c6daa16e6c69cf63e39bdf | assert_*|test_too_short_variable_names_configured|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.violations.naming import ( PrivateNameViolation, TooShortVariableNameViolation, WrongVariableNameViolation, ) from wemake_python_styleguide.visitors.ast.naming import ( BAD_VARIABLE_NAMES,... | null | null | null |
wemake-services/wemake-python-styleguide | train | 43 | 61ee0b4cf653ba0839ee3bd5502a3ffd482dfcc8 | train | tests/test_visitors/test_ast/test_general/test_wrong_name/test_variable_names.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_wrong_name/test_variable_names.py | 141 | 4 | assert_* | test_private_variable_names | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.violations.naming import (
PrivateNameViolation,
TooShortVariableNameViolation,
WrongVariableNameViolation,
)
from wemake_python_styleguide.visitors.ast.naming import (
BAD_VARIABLE_NAMES,
WrongNameVisitor,
)
varia... | [PrivateNameViolation]) | added | 98626060c957c92b5a394d65bf75b4c85e9f735348f7a70730ea80694f682f06 | assert_*|test_private_variable_names|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.violations.naming import ( PrivateNameViolation, TooShortVariableNameViolation, WrongVariableNameViolation, ) from wemake_python_styleguide.visitors.ast.naming import ( BAD_VARIABLE_NAMES, WrongNameVis... | null | null | null |
wemake-services/wemake-python-styleguide | train | 44 | 51fe2ace562eeb4e645c5a74e5ac52449c19d8cd | train | tests/test_visitors/test_ast/test_general/test_wrong_name/test_function_args_names.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_wrong_name/test_function_args_names.py | 94 | 4 | assert_* | test_wrong_function_arguments | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.naming import (
PrivateNameViolation,
TooShortVariableNameViolation,
WrongVariableNameViolation,
)
from wemake_python_styleguide.visitors.ast.naming import (
BAD_VARIABLE_NAMES,
WrongNameVisitor,
)
function_test = """
... | [ TooShortVariableNameViolation, WrongVariableNameViolation, ]) | added | e48f6fec1f8565f953e89dc9bd1814b4c075148a8895416a30e5f8fdaac8e2fa | assert_*|test_wrong_function_arguments|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.naming import ( PrivateNameViolation, TooShortVariableNameViolation, WrongVariableNameViolation, ) from wemake_python_styleguide.visitors.ast.naming import ( BAD_VARIABLE_NAMES, WrongNameVisitor, ) func... | null | null | null |
wemake-services/wemake-python-styleguide | train | 44 | 51fe2ace562eeb4e645c5a74e5ac52449c19d8cd | train | tests/test_visitors/test_ast/test_general/test_wrong_name/test_function_args_names.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_wrong_name/test_function_args_names.py | 123 | 4 | assert_* | test_private_function_arguments | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.naming import (
PrivateNameViolation,
TooShortVariableNameViolation,
WrongVariableNameViolation,
)
from wemake_python_styleguide.visitors.ast.naming import (
BAD_VARIABLE_NAMES,
WrongNameVisitor,
)
function_test = """
... | [ PrivateNameViolation, PrivateNameViolation, ]) | added | ca47280b2e8513a397b134b1a53c44c99561a7dabcc6c4947d59fe65ceedd8a6 | assert_*|test_private_function_arguments|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.naming import ( PrivateNameViolation, TooShortVariableNameViolation, WrongVariableNameViolation, ) from wemake_python_styleguide.visitors.ast.naming import ( BAD_VARIABLE_NAMES, WrongNameVisitor, ) fu... | null | null | null |
wemake-services/wemake-python-styleguide | train | 44 | 51fe2ace562eeb4e645c5a74e5ac52449c19d8cd | train | tests/test_visitors/test_ast/test_general/test_wrong_name/test_function_names.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_wrong_name/test_function_names.py | 46 | 4 | assert_* | test_wrong_function_names | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.violations.naming import (
PrivateNameViolation,
TooShortVariableNameViolation,
WrongVariableNameViolation,
)
from wemake_python_styleguide.visitors.ast.naming import (
BAD_VARIABLE_NAMES,
WrongNameVisitor,
)
funct... | [WrongVariableNameViolation]) | added | fcc9d5575671a6e60bf007ff866292fcef954952ff84f4aa3663276e87268154 | assert_*|test_wrong_function_names|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.violations.naming import ( PrivateNameViolation, TooShortVariableNameViolation, WrongVariableNameViolation, ) from wemake_python_styleguide.visitors.ast.naming import ( BAD_VARIABLE_NAMES, WrongNameVisit... | null | null | null |
wemake-services/wemake-python-styleguide | train | 44 | 51fe2ace562eeb4e645c5a74e5ac52449c19d8cd | train | tests/test_visitors/test_ast/test_general/test_wrong_name/test_function_names.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_wrong_name/test_function_names.py | 64 | 4 | assert_* | test_too_short_function_names | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.violations.naming import (
PrivateNameViolation,
TooShortVariableNameViolation,
WrongVariableNameViolation,
)
from wemake_python_styleguide.visitors.ast.naming import (
BAD_VARIABLE_NAMES,
WrongNameVisitor,
)
funct... | [TooShortVariableNameViolation]) | modified | 04d0b92e64324eaa6aa2f413b26e58ce8f50961984490345c834cdcfaa6c2cc5 | assert_*|test_too_short_function_names|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.violations.naming import ( PrivateNameViolation, TooShortVariableNameViolation, WrongVariableNameViolation, ) from wemake_python_styleguide.visitors.ast.naming import ( BAD_VARIABLE_NAMES, WrongNameV... | [TooShortVariableNameViolation]) | 64 | 4 |
wemake-services/wemake-python-styleguide | train | 44 | 51fe2ace562eeb4e645c5a74e5ac52449c19d8cd | train | tests/test_visitors/test_ast/test_general/test_wrong_name/test_function_names.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_wrong_name/test_function_names.py | 81 | 4 | assert_* | test_private_function_names | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.violations.naming import (
PrivateNameViolation,
TooShortVariableNameViolation,
WrongVariableNameViolation,
)
from wemake_python_styleguide.visitors.ast.naming import (
BAD_VARIABLE_NAMES,
WrongNameVisitor,
)
funct... | [PrivateNameViolation]) | modified | 6260903f4c90888e202e782cefa4c05d959251d009d9dbc5b3870d9ccb11f537 | assert_*|test_private_function_names|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.violations.naming import ( PrivateNameViolation, TooShortVariableNameViolation, WrongVariableNameViolation, ) from wemake_python_styleguide.visitors.ast.naming import ( BAD_VARIABLE_NAMES, WrongNameVis... | [PrivateNameViolation]) | 81 | 4 |
wemake-services/wemake-python-styleguide | train | 45 | be4de16931acad60c7249b80d3d2eef13a02defe | train | tests/test_visitors/test_ast/test_general/test_magic_numbers.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_magic_numbers.py | 144 | 4 | assert_* | test_magic_number_warning | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
MagicNumberViolation,
)
from wemake_python_styleguide.visitors.ast.numbers import (
MAGIC_NUMBERS_WHITELIST,
MagicNumberVisitor,
)
# Correct usages:
assignment = 'constant = {0}'
assignment_unary = 'co... | [MagicNumberViolation]) | added | 05921ee7c774c05bcbf3ed40786de77f8c22dbfbfc7f3289e276f331f154a665 | assert_*|test_magic_number_warning|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( MagicNumberViolation, ) from wemake_python_styleguide.visitors.ast.numbers import ( MAGIC_NUMBERS_WHITELIST, MagicNumberVisitor, ) # Correct usages: assignment = 'constant = {0}' ass... | null | null | null |
wemake-services/wemake-python-styleguide | train | 46 | d451e213b92393b9398d80815d73d26dcaf15be1 | train | tests/test_visitors/test_ast/test_complexity/test_function/test_elifs.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_complexity/test_function/test_elifs.py | 92 | 4 | assert_* | test_elif_incorrect_count | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.complexity.function import (
FunctionComplexityVisitor,
TooManyElifsViolation,
)
function_with_elifs = """
{0}def test_module():
if 1 > 2:
print(1)
elif 2 > 3:
print(2)
elif 3 > 4:
print(3)
... | [TooManyElifsViolation]) | added | 81755de628c6f85f94acc6ce8ab8ea1c8e8454b35456acc0502afb613220e7ff | assert_*|test_elif_incorrect_count|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.complexity.function import ( FunctionComplexityVisitor, TooManyElifsViolation, ) function_with_elifs = """ {0}def test_module(): if 1 > 2: print(1) elif 2 > 3: print(2) elif 3 > 4: print(3) else: print(4)... | null | null | null |
wemake-services/wemake-python-styleguide | train | 46 | d451e213b92393b9398d80815d73d26dcaf15be1 | train | tests/test_visitors/test_ast/test_complexity/test_function/test_expressions.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_complexity/test_function/test_expressions.py | 58 | 4 | assert_* | test_expressions_wrong_count | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.complexity.function import (
FunctionComplexityVisitor,
TooManyExpressionsViolation,
)
function_without_expressions = """
{0}def function(): ...
"""
function_with_expressions = """
{0}def function():
print(12)
print(12 ... | [TooManyExpressionsViolation]) | added | 60a988513a61515db6eeb4b83e70cfcb70ba2702b6c50d5af7d6cabb6b5b0442 | assert_*|test_expressions_wrong_count|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.complexity.function import ( FunctionComplexityVisitor, TooManyExpressionsViolation, ) function_without_expressions = """ {0}def function(): ... """ function_with_expressions = """ {0}def function(): p... | null | null | null |
wemake-services/wemake-python-styleguide | train | 46 | d451e213b92393b9398d80815d73d26dcaf15be1 | train | tests/test_visitors/test_ast/test_complexity/test_function/test_local_variables.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_complexity/test_function/test_local_variables.py | 85 | 4 | assert_* | test_locals_wrong_count | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.complexity.function import (
FunctionComplexityVisitor,
TooManyLocalsViolation,
)
function_with_locals = """
{0}def function():
local_variable1 = 1
local_variable2 = 2
_ = None # `_` is not counted
"""
function_wit... | [TooManyLocalsViolation]) | added | 1033ad6a7be6446d95361ba5acb785343931051944113a188573335410e62a62 | assert_*|test_locals_wrong_count|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.complexity.function import ( FunctionComplexityVisitor, TooManyLocalsViolation, ) function_with_locals = """ {0}def function(): local_variable1 = 1 local_variable2 = 2 _ = None # `_` is not counted """ func... | null | null | null |
wemake-services/wemake-python-styleguide | train | 46 | d451e213b92393b9398d80815d73d26dcaf15be1 | train | tests/test_visitors/test_ast/test_complexity/test_function/test_returns.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_complexity/test_function/test_returns.py | 57 | 4 | assert_* | test_returns_wrong_count | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.complexity.function import (
FunctionComplexityVisitor,
TooManyReturnsViolation,
)
function_without_returns = '{0}def function(): ...'
function_with_returns = """
{0}def function():
if 1 > 2:
return 1
return 0
"... | [TooManyReturnsViolation]) | added | b89b23e8c762802fcc76e7e8b39666a41b6852dd390155e35d70e7dc0fe27ce1 | assert_*|test_returns_wrong_count|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.complexity.function import ( FunctionComplexityVisitor, TooManyReturnsViolation, ) function_without_returns = '{0}def function(): ...' function_with_returns = """ {0}def function(): if 1 > 2: return 1 retu... | null | null | null |
wemake-services/wemake-python-styleguide | train | 47 | 2d71ed96c4585773de67c8197ce03c5b4eef82d4 | train | tests/test_visitors/test_ast/test_complexity/test_jones/test_line_complexity.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_complexity/test_jones/test_line_complexity.py | 96 | 4 | assert_* | test_complex_lines | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.complexity.jones import (
JonesComplexityVisitor,
LineComplexityViolation,
)
line_simple = 'x = 2'
line_with_types = 'x: int = 2'
line_with_comprehension = 'x = [f for f in "abc"]'
line_with_math = 'x = y * 2 + 19 / 9.3'
line_in... | [LineComplexityViolation]) | added | f9fe213fb3dda056296850a13bae6e883ab8377e33515661d249abff51dcad63 | assert_*|test_complex_lines|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.complexity.jones import ( JonesComplexityVisitor, LineComplexityViolation, ) line_simple = 'x = 2' line_with_types = 'x: int = 2' line_with_comprehension = 'x = [f for f in "abc"]' line_with_math = 'x = y * 2 + ... | null | null | null |
wemake-services/wemake-python-styleguide | train | 47 | 2d71ed96c4585773de67c8197ce03c5b4eef82d4 | train | tests/test_visitors/test_ast/test_complexity/test_jones/test_line_complexity.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_complexity/test_jones/test_line_complexity.py | 116 | 4 | assert | test_same_complexity | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.complexity.jones import (
JonesComplexityVisitor,
LineComplexityViolation,
)
line_simple = 'x = 2'
line_with_types = 'x: int = 2'
line_with_comprehension = 'x = [f for f in "abc"]'
line_with_math = 'x = y * 2 + 19 / 9.3'
line_in... | len(typed_visitor._lines[1]) | added | e005987b28387014559710cfb51eb338b5277e30014894d51bc61d8ab98e01d1 | assert|test_same_complexity|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.complexity.jones import ( JonesComplexityVisitor, LineComplexityViolation, ) line_simple = 'x = 2' line_with_types = 'x: int = 2' line_with_comprehension = 'x = [f for f in "abc"]' line_with_math = 'x = y * 2 + ... | null | null | null |
wemake-services/wemake-python-styleguide | train | 47 | 2d71ed96c4585773de67c8197ce03c5b4eef82d4 | train | tests/test_visitors/test_ast/test_complexity/test_jones/test_line_complexity.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_complexity/test_jones/test_line_complexity.py | 131 | 4 | assert | test_exact_complexity | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.complexity.jones import (
JonesComplexityVisitor,
LineComplexityViolation,
)
line_simple = 'x = 2'
line_with_types = 'x: int = 2'
line_with_comprehension = 'x = [f for f in "abc"]'
line_with_math = 'x = y * 2 + 19 / 9.3'
line_in... | complexity | added | a7fcac61d2414be47a58e948b113f5533a22b8135a6b7ab1177bbbbde51c4363 | assert|test_exact_complexity|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.complexity.jones import ( JonesComplexityVisitor, LineComplexityViolation, ) line_simple = 'x = 2' line_with_types = 'x: int = 2' line_with_comprehension = 'x = [f for f in "abc"]' line_with_math = 'x = y * 2 +... | null | null | null |
wemake-services/wemake-python-styleguide | train | 47 | 2d71ed96c4585773de67c8197ce03c5b4eef82d4 | train | tests/test_visitors/test_ast/test_complexity/test_jones/test_line_complexity.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_complexity/test_jones/test_line_complexity.py | 150 | 4 | assert | test_that_some_nodes_are_ignored | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.complexity.jones import (
JonesComplexityVisitor,
LineComplexityViolation,
)
line_simple = 'x = 2'
line_with_types = 'x: int = 2'
line_with_comprehension = 'x = [f for f in "abc"]'
line_with_math = 'x = y * 2 + 19 / 9.3'
line_in... | number_of_lines | added | 635aaf9c68a3e125c5aa1bdc8c61a6079fc2c2bd63b96becc98ac9f1a2acd963 | assert|test_that_some_nodes_are_ignored|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.complexity.jones import ( JonesComplexityVisitor, LineComplexityViolation, ) line_simple = 'x = 2' line_with_types = 'x: int = 2' line_with_comprehension = 'x = [f for f in "abc"]' line_with_math = '... | null | null | null |
wemake-services/wemake-python-styleguide | train | 48 | b5e891713c582a140d9301e8284611a21c7ddd65 | train | tests/test_visitors/test_ast/test_complexity/test_nested/test_nested_classes.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_complexity/test_nested/test_nested_classes.py | 55 | 4 | assert_* | test_nested_class | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
NestedClassViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.nested import (
NESTED_CLASSES_WHITELIST,
NestedComplexityVisitor,
)
nested_class = """
class Parent(object):
class {0}(... | [NestedClassViolation]) | added | 3d854daae0db020a108da00ac145ada360d8d67f10dc1ab98c54b0f06e59e2bf | assert_*|test_nested_class|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( NestedClassViolation, ) from wemake_python_styleguide.visitors.ast.complexity.nested import ( NESTED_CLASSES_WHITELIST, NestedComplexityVisitor, ) nested_class = """ class Parent(object): cl... | null | null | null |
wemake-services/wemake-python-styleguide | train | 48 | b5e891713c582a140d9301e8284611a21c7ddd65 | train | tests/test_visitors/test_ast/test_complexity/test_nested/test_nested_classes.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_complexity/test_nested/test_nested_classes.py | 93 | 4 | assert_* | test_whitelist_nested_classes_in_functions | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
NestedClassViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.nested import (
NESTED_CLASSES_WHITELIST,
NestedComplexityVisitor,
)
nested_class = """
class Parent(object):
class {0}(... | [NestedClassViolation]) | added | 76c8a4e7e17bd0c8304faa75eb2a904cf1ba19ccfcd4e82a5e7a1afaedf1eaea | assert_*|test_whitelist_nested_classes_in_functions|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( NestedClassViolation, ) from wemake_python_styleguide.visitors.ast.complexity.nested import ( NESTED_CLASSES_WHITELIST, NestedComplexityVisitor, ) nested_class = """... | null | null | null |
wemake-services/wemake-python-styleguide | train | 48 | b5e891713c582a140d9301e8284611a21c7ddd65 | train | tests/test_visitors/test_ast/test_complexity/test_nested/test_nested_functions.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_complexity/test_nested/test_nested_functions.py | 103 | 4 | assert_* | test_nested_function | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
NestedFunctionViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.nested import (
NESTED_FUNCTIONS_WHITELIST,
NestedComplexityVisitor,
)
# Functions:
nested_function_in_function = """
de... | [NestedFunctionViolation]) | added | 1f578cc489e53d1614eb6b57de4adfe1657a25a8867301aeffd4bf41b93d85ae | assert_*|test_nested_function|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( NestedFunctionViolation, ) from wemake_python_styleguide.visitors.ast.complexity.nested import ( NESTED_FUNCTIONS_WHITELIST, NestedComplexityVisitor, ) # Functions: nested_function_in_fun... | null | null | null |
wemake-services/wemake-python-styleguide | train | 48 | b5e891713c582a140d9301e8284611a21c7ddd65 | train | tests/test_visitors/test_ast/test_complexity/test_nested/test_nested_functions.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_complexity/test_nested/test_nested_functions.py | 161 | 4 | assert_* | test_lambda_nested_lambdas | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
NestedFunctionViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.nested import (
NESTED_FUNCTIONS_WHITELIST,
NestedComplexityVisitor,
)
# Functions:
nested_function_in_function = """
de... | [NestedFunctionViolation]) | added | 390009473c862bcaae8d318600c6041e82ad58b42379a8415832f291bcc3815f | assert_*|test_lambda_nested_lambdas|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.best_practices import ( NestedFunctionViolation, ) from wemake_python_styleguide.visitors.ast.complexity.nested import ( NESTED_FUNCTIONS_WHITELIST, NestedComplexityVisitor, ) # Functions: nested_function_... | null | null | null |
wemake-services/wemake-python-styleguide | train | 48 | b5e891713c582a140d9301e8284611a21c7ddd65 | train | tests/test_visitors/test_ast/test_general/test_wrong_class/test_magic_methods.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_general/test_wrong_class/test_magic_methods.py | 40 | 4 | assert_* | test_wrong_magic_used | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.constants import BAD_MAGIC_METHODS
from wemake_python_styleguide.violations.best_practices import (
BadMagicMethodViolation,
)
from wemake_python_styleguide.visitors.ast.classes import WrongClassVisitor
magic_method = """
class Example(object):
... | [BadMagicMethodViolation]) | added | 4bc82ae54ab080e8453144114c398e272f17626018fa3f04930f35b33cb9198d | assert_*|test_wrong_magic_used|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.constants import BAD_MAGIC_METHODS from wemake_python_styleguide.violations.best_practices import ( BadMagicMethodViolation, ) from wemake_python_styleguide.visitors.ast.classes import WrongClassVisitor magic_method = """... | null | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.