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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
wee-slack/wee-slack | train | 90 | bfa38ba5ee0a7a4387eddc30feb1e3ad2e1aab78 | train | tests/test_sleep.py | train | wee-slack/wee-slack:tests/test_sleep.py | 22 | 9 | pytest.raises | test_sleep | from unittest.mock import MagicMock, patch
import pytest
import weechat
from slack.task import FutureTimer, sleep, weechat_task_cb
from slack.util import get_callback_name
@patch.object(weechat, "hook_timer")
def test_sleep(mock_method: MagicMock):
milliseconds = 123
coroutine = sleep(milliseconds)
futu... | StopIteration) | modified | df3bc3455e283f18537645da5d7f17b734441b96cac50e05c4af7132d0510394 | pytest.raises|test_sleep|from unittest.mock import MagicMock, patch import pytest import weechat from slack.task import FutureTimer, sleep, weechat_task_cb from slack.util import get_callback_name @patch.object(weechat, "hook_timer") def test_sleep(mock_method: MagicMock): milliseconds = 123 coroutine = sleep(milliseco... | StopIteration) | 21 | 9 |
wee-slack/wee-slack | train | 91 | 748991ae4d0bf3726b4a1eeb851b2d3a6446b2bb | train | tests/test_http_request.py | val | wee-slack/wee-slack:tests/test_http_request.py | 61 | 4 | assert | test_http_request_error_process_stderr | from textwrap import dedent
from unittest.mock import MagicMock, patch
import pytest
import weechat
from slack.http import HttpError, http_request
from slack.task import FutureProcess, FutureTimer, weechat_task_cb
from slack.util import get_callback_name
@patch.object(weechat, "hook_process_hashtable")
def test_htt... | isinstance(future, FutureProcess) | modified | 34c77e1ee9e22eddcc1fd44f7b993d94f7e5609eb895449965a6c8aa4e772671 | assert|test_http_request_error_process_stderr|from textwrap import dedent from unittest.mock import MagicMock, patch import pytest import weechat from slack.http import HttpError, http_request from slack.task import FutureProcess, FutureTimer, weechat_task_cb from slack.util import get_callback_name @patch.object(weech... | isinstance(future, FutureProcess) | 61 | 4 |
wee-slack/wee-slack | train | 91 | 748991ae4d0bf3726b4a1eeb851b2d3a6446b2bb | train | tests/test_http_request.py | val | wee-slack/wee-slack:tests/test_http_request.py | 102 | 4 | assert | test_http_request_error_retry_success | from textwrap import dedent
from unittest.mock import MagicMock, patch
import pytest
import weechat
from slack.http import HttpError, http_request
from slack.task import FutureProcess, FutureTimer, weechat_task_cb
from slack.util import get_callback_name
@patch.object(weechat, "hook_process_hashtable")
def test_htt... | isinstance(future_2, FutureTimer) | modified | 8c777fe483b94f887accf6acb979b6b59286aa33234680c7801c5fb0eb489b4f | assert|test_http_request_error_retry_success|from textwrap import dedent from unittest.mock import MagicMock, patch import pytest import weechat from slack.http import HttpError, http_request from slack.task import FutureProcess, FutureTimer, weechat_task_cb from slack.util import get_callback_name @patch.object(weecha... | isinstance(future_2, FutureTimer) | 102 | 4 |
wee-slack/wee-slack | train | 91 | 748991ae4d0bf3726b4a1eeb851b2d3a6446b2bb | train | tests/test_http_request.py | val | wee-slack/wee-slack:tests/test_http_request.py | 175 | 4 | assert | test_http_request_multiple_headers | from textwrap import dedent
from unittest.mock import MagicMock, patch
import pytest
import weechat
from slack.http import HttpError, http_request
from slack.task import FutureProcess, FutureTimer, weechat_task_cb
from slack.util import get_callback_name
@patch.object(weechat, "hook_process_hashtable")
def test_htt... | response | modified | 4021a03ed3fe5619caa924b13671d7656c9589ea9722a710aab584db17384947 | assert|test_http_request_multiple_headers|from textwrap import dedent from unittest.mock import MagicMock, patch import pytest import weechat from slack.http import HttpError, http_request from slack.task import FutureProcess, FutureTimer, weechat_task_cb from slack.util import get_callback_name @patch.object(weechat, ... | response | 175 | 4 |
wee-slack/wee-slack | train | 91 | 748991ae4d0bf3726b4a1eeb851b2d3a6446b2bb | train | tests/test_http_request.py | val | wee-slack/wee-slack:tests/test_http_request.py | 205 | 4 | assert | test_http_request_ratelimit | from textwrap import dedent
from unittest.mock import MagicMock, patch
import pytest
import weechat
from slack.http import HttpError, http_request
from slack.task import FutureProcess, FutureTimer, weechat_task_cb
from slack.util import get_callback_name
@patch.object(weechat, "hook_process_hashtable")
def test_htt... | response | modified | e5ffb3915a277ccf2958babf45f6ab41fcddba36271f4fac02c3a24c7258b16a | assert|test_http_request_ratelimit|from textwrap import dedent from unittest.mock import MagicMock, patch import pytest import weechat from slack.http import HttpError, http_request from slack.task import FutureProcess, FutureTimer, weechat_task_cb from slack.util import get_callback_name @patch.object(weechat, "hook_p... | response | 205 | 4 |
wee-slack/wee-slack | train | 92 | 0b46f31f14e9a69568535b2c73bc00fc396e2d71 | train | tests/test_http_request.py | val | wee-slack/wee-slack:tests/test_http_request.py | 36 | 4 | assert | test_http_request_success | from textwrap import dedent
from unittest.mock import MagicMock, patch
import pytest
import weechat
from slack.http import HttpError, http_request, http_request_process, http_request_url
from slack.task import FutureProcess, FutureTimer, FutureUrl, weechat_task_cb
from slack.util import get_callback_name
@patch.obj... | "response" | added | 1ef1e4491bd603bef5ac24e2062a32bed4138cdba71c59a50cb39cee2e5a3e88 | assert|test_http_request_success|from textwrap import dedent from unittest.mock import MagicMock, patch import pytest import weechat from slack.http import HttpError, http_request, http_request_process, http_request_url from slack.task import FutureProcess, FutureTimer, FutureUrl, weechat_task_cb from slack.util import... | null | null | null |
wee-slack/wee-slack | train | 92 | 0b46f31f14e9a69568535b2c73bc00fc396e2d71 | train | tests/test_http_request.py | val | wee-slack/wee-slack:tests/test_http_request.py | 60 | 9 | pytest.raises | test_http_request_process_success | from textwrap import dedent
from unittest.mock import MagicMock, patch
import pytest
import weechat
from slack.http import HttpError, http_request, http_request_process, http_request_url
from slack.task import FutureProcess, FutureTimer, FutureUrl, weechat_task_cb
from slack.util import get_callback_name
@patch.obj... | StopIteration) | added | 669c2c0a6356725edfa89ef782f5d28a21bd7330b400fdb07f43b4406d71f9a1 | pytest.raises|test_http_request_process_success|from textwrap import dedent from unittest.mock import MagicMock, patch import pytest import weechat from slack.http import HttpError, http_request, http_request_process, http_request_url from slack.task import FutureProcess, FutureTimer, FutureUrl, weechat_task_cb from sl... | null | null | null |
wee-slack/wee-slack | train | 92 | 0b46f31f14e9a69568535b2c73bc00fc396e2d71 | train | tests/test_http_request.py | val | wee-slack/wee-slack:tests/test_http_request.py | 78 | 4 | assert | test_http_request_url_error | from textwrap import dedent
from unittest.mock import MagicMock, patch
import pytest
import weechat
from slack.http import HttpError, http_request, http_request_process, http_request_url
from slack.task import FutureProcess, FutureTimer, FutureUrl, weechat_task_cb
from slack.util import get_callback_name
@patch.obj... | None | added | 21ca2248571b0b2179886d207116f2b41243c7e15134a8046699e08cd923c996 | assert|test_http_request_url_error|from textwrap import dedent from unittest.mock import MagicMock, patch import pytest import weechat from slack.http import HttpError, http_request, http_request_process, http_request_url from slack.task import FutureProcess, FutureTimer, FutureUrl, weechat_task_cb from slack.util impo... | null | null | null |
wee-slack/wee-slack | train | 92 | 0b46f31f14e9a69568535b2c73bc00fc396e2d71 | train | tests/test_http_request.py | val | wee-slack/wee-slack:tests/test_http_request.py | 217 | 4 | assert | test_http_request_url_multiple_headers | from textwrap import dedent
from unittest.mock import MagicMock, patch
import pytest
import weechat
from slack.http import HttpError, http_request, http_request_process, http_request_url
from slack.task import FutureProcess, FutureTimer, FutureUrl, weechat_task_cb
from slack.util import get_callback_name
@patch.obj... | ( 200, "2 200\r\ncontent-type: application/json; charset=utf-8", "response", ) | added | 403e68477c4e7566d015b9686a93bcfbcda481c4130b3fa33e898cdc2c3ff0c3 | assert|test_http_request_url_multiple_headers|from textwrap import dedent from unittest.mock import MagicMock, patch import pytest import weechat from slack.http import HttpError, http_request, http_request_process, http_request_url from slack.task import FutureProcess, FutureTimer, FutureUrl, weechat_task_cb from slac... | null | null | null |
wee-slack/wee-slack | train | 93 | c47aeb31b5f6f1843c0505e539fdff3352c76f80 | train | tests/test_slackts.py | train | wee-slack/wee-slack:tests/test_slackts.py | 25 | 4 | assert | test_slackts_ne | from slack.slack_message import SlackTs
str_base = "1234567890.012345"
str_base_not_padded = "1234567890.12345"
str_different_minor = "1234567890.012346"
str_different_major = "1234567891.012345"
ts_base = SlackTs(str_base)
ts_base_not_padded = SlackTs(str_base_not_padded)
ts_different_minor = SlackTs(str_different_m... | ts_different_minor | added | ef2fa43964a07ab0ff072d707a90f2005ea388d2e545330f9547deee11db817d | assert|test_slackts_ne|from slack.slack_message import SlackTs str_base = "1234567890.012345" str_base_not_padded = "1234567890.12345" str_different_minor = "1234567890.012346" str_different_major = "1234567891.012345" ts_base = SlackTs(str_base) ts_base_not_padded = SlackTs(str_base_not_padded) ts_different_minor = Sl... | null | null | null |
wee-slack/wee-slack | train | 93 | c47aeb31b5f6f1843c0505e539fdff3352c76f80 | train | tests/test_slackts.py | train | wee-slack/wee-slack:tests/test_slackts.py | 57 | 4 | assert | test_slackts_ge | from slack.slack_message import SlackTs
str_base = "1234567890.012345"
str_base_not_padded = "1234567890.12345"
str_different_minor = "1234567890.012346"
str_different_major = "1234567891.012345"
ts_base = SlackTs(str_base)
ts_base_not_padded = SlackTs(str_base_not_padded)
ts_different_minor = SlackTs(str_different_m... | not ts_base >= ts_different_major | added | c03b68eb8fcee0ee758ae6a14731c1e1cd51653785d9ef1c765b50384e470e8a | assert|test_slackts_ge|from slack.slack_message import SlackTs str_base = "1234567890.012345" str_base_not_padded = "1234567890.12345" str_different_minor = "1234567890.012346" str_different_major = "1234567891.012345" ts_base = SlackTs(str_base) ts_base_not_padded = SlackTs(str_base_not_padded) ts_different_minor = Sl... | null | null | null |
wee-slack/wee-slack | train | 93 | c47aeb31b5f6f1843c0505e539fdff3352c76f80 | train | tests/test_slackts.py | train | wee-slack/wee-slack:tests/test_slackts.py | 68 | 4 | assert | test_slackts_lt | from slack.slack_message import SlackTs
str_base = "1234567890.012345"
str_base_not_padded = "1234567890.12345"
str_different_minor = "1234567890.012346"
str_different_major = "1234567891.012345"
ts_base = SlackTs(str_base)
ts_base_not_padded = SlackTs(str_base_not_padded)
ts_different_minor = SlackTs(str_different_m... | not ts_base < ts_base_not_padded | added | 2522a7225702fdd8567f3e65f39fbcd8b89f92083e202fae2a0c47178053f5b4 | assert|test_slackts_lt|from slack.slack_message import SlackTs str_base = "1234567890.012345" str_base_not_padded = "1234567890.12345" str_different_minor = "1234567890.012346" str_different_major = "1234567891.012345" ts_base = SlackTs(str_base) ts_base_not_padded = SlackTs(str_base_not_padded) ts_different_minor = Sl... | null | null | null |
wee-slack/wee-slack | train | 93 | c47aeb31b5f6f1843c0505e539fdff3352c76f80 | train | tests/test_slackts.py | train | wee-slack/wee-slack:tests/test_slackts.py | 85 | 4 | assert | test_slackts_le | from slack.slack_message import SlackTs
str_base = "1234567890.012345"
str_base_not_padded = "1234567890.12345"
str_different_minor = "1234567890.012346"
str_different_major = "1234567891.012345"
ts_base = SlackTs(str_base)
ts_base_not_padded = SlackTs(str_base_not_padded)
ts_different_minor = SlackTs(str_different_m... | not ts_different_major <= ts_base | added | 8cacd11b93660d09b86657e1b41fbf6092f8b655503082aa60e542e3b90425bb | assert|test_slackts_le|from slack.slack_message import SlackTs str_base = "1234567890.012345" str_base_not_padded = "1234567890.12345" str_different_minor = "1234567890.012346" str_different_major = "1234567891.012345" ts_base = SlackTs(str_base) ts_base_not_padded = SlackTs(str_base_not_padded) ts_different_minor = Sl... | null | null | null |
wee-slack/wee-slack | train | 94 | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | train | tests/conftest.py | train | wee-slack/wee-slack:tests/conftest.py | 159 | 9 | pytest.raises | from __future__ import annotations
import importlib
import importlib.machinery
import json
import sys
from typing import TYPE_CHECKING, Union
import pytest
if TYPE_CHECKING:
from slack_api.slack_conversations_history import (
SlackConversationsHistorySuccessResponse,
)
from slack_api.slack_conver... | StopIteration) | added | 8e2dfbd08193acc75bb18287fda9cb4b403c3e09ecdeae43a3935678bda3ab59 | pytest.raises||from __future__ import annotations import importlib import importlib.machinery import json import sys from typing import TYPE_CHECKING, Union import pytest if TYPE_CHECKING: from slack_api.slack_conversations_history import ( SlackConversationsHistorySuccessResponse, ) from slack_api.slack_conversations_... | null | null | null | |
wee-slack/wee-slack | train | 94 | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | train | tests/test_unfurl.py | train | wee-slack/wee-slack:tests/test_unfurl.py | 61 | 4 | assert | test_unfurl_refs | from __future__ import annotations
from typing import TYPE_CHECKING, List
import pytest
from slack.slack_message import SlackMessage
from tests.conftest import (
channel_public_id,
color_channel_mention,
color_reset,
color_user_mention,
color_usergroup_mention,
resolve_pending_message_item,
... | case["output"] | added | c14e3a674e4af5f558063e866b54872093d31b1b75a13f62fc9421ee7b94d258 | assert|test_unfurl_refs|from __future__ import annotations from typing import TYPE_CHECKING, List import pytest from slack.slack_message import SlackMessage from tests.conftest import ( channel_public_id, color_channel_mention, color_reset, color_user_mention, color_usergroup_mention, resolve_pending_message_item, user... | null | null | null |
wemake-services/wemake-python-styleguide | train | 7 | 4c0919e4bcb32f2b13baf756b89d43b3f0d8b7ba | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 32 | 12 | assert | # -*- coding: utf-8 -*-
import ast
from textwrap import dedent
from typing import Sequence
import pytest
from wemake_python_styleguide.visitors.base.visitor import BaseNodeVisitor
@pytest.fixture(scope='session')
def parse_ast_tree():
"""Helper function to convert code to ast."""
def factory(code: str) -> ... | errors[index] | added | 58fc383c33d96d9d32d583f630a08983b0d82e4af696baeb482e7dc29408bd5c | assert||# -*- coding: utf-8 -*- import ast from textwrap import dedent from typing import Sequence import pytest from wemake_python_styleguide.visitors.base.visitor import BaseNodeVisitor @pytest.fixture(scope='session') def parse_ast_tree(): """Helper function to convert code to ast.""" def factory(code: str) -> ast.A... | null | null | null | |
wemake-services/wemake-python-styleguide | train | 7 | 4c0919e4bcb32f2b13baf756b89d43b3f0d8b7ba | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 34 | 8 | assert | # -*- coding: utf-8 -*-
import ast
from textwrap import dedent
from typing import Sequence
import pytest
from wemake_python_styleguide.visitors.base.visitor import BaseNodeVisitor
@pytest.fixture(scope='session')
def parse_ast_tree():
"""Helper function to convert code to ast."""
def factory(code: str) -> ... | len(errors) | added | 81a2e8edb4224130aaaa576ea740c19068bf39f7a4b591d52499d9810c657050 | assert||# -*- coding: utf-8 -*- import ast from textwrap import dedent from typing import Sequence import pytest from wemake_python_styleguide.visitors.base.visitor import BaseNodeVisitor @pytest.fixture(scope='session') def parse_ast_tree(): """Helper function to convert code to ast.""" def factory(code: str) -> ast.A... | null | null | null | |
wemake-services/wemake-python-styleguide | train | 7 | 4c0919e4bcb32f2b13baf756b89d43b3f0d8b7ba | train | tests/test_visitors/test_wrong_keyword/test_bare_raise.py | test | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_keyword/test_bare_raise.py | 31 | 4 | assert_* | test_bare_raise_keyword | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.wrong_keyword import (
BareRiseViolation,
WrongRaiseVisitor,
)
bare_raise_module = """
raise
"""
bare_raise_function = """
def function():
raise
"""
@pytest.mark.parametrize('code', [
bare_raise_module,
bare_raise_fun... | [BareRiseViolation._code]) | added | cb8cf0aae345cae0bb040f555f73300937f433f7687c32f70507862502fe51e3 | assert_*|test_bare_raise_keyword|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.wrong_keyword import ( BareRiseViolation, WrongRaiseVisitor, ) bare_raise_module = """ raise """ bare_raise_function = """ def function(): raise """ @pytest.mark.parametrize('code', [ bare_raise_module, bare_ra... | null | null | null |
wemake-services/wemake-python-styleguide | train | 7 | 4c0919e4bcb32f2b13baf756b89d43b3f0d8b7ba | train | tests/test_visitors/test_wrong_keyword/test_del.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_keyword/test_del.py | 21 | 4 | assert_* | test_del_keyword | # -*- coding: utf-8 -*-
from wemake_python_styleguide.visitors.wrong_keyword import (
WrongKeywordViolation,
WrongKeywordVisitor,
)
def test_del_keyword(assert_errors, parse_ast_tree):
"""Testing that `del` keyword is restricted."""
tree = parse_ast_tree("""
def check_del():
s = {'key': '... | [ WrongKeywordViolation._code, WrongKeywordViolation._code, ]) | added | 08674af3c4d9641b1b82db3d597dc59dd06fd9872f5d4b36d99db87f0dbc4e9c | assert_*|test_del_keyword|# -*- coding: utf-8 -*- from wemake_python_styleguide.visitors.wrong_keyword import ( WrongKeywordViolation, WrongKeywordVisitor, ) def test_del_keyword(assert_errors, parse_ast_tree): """Testing that `del` keyword is restricted.""" tree = parse_ast_tree(""" def check_del(): s = {'key': 'value... | null | null | null |
wemake-services/wemake-python-styleguide | train | 7 | 4c0919e4bcb32f2b13baf756b89d43b3f0d8b7ba | train | tests/test_visitors/test_wrong_keyword/test_global.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_keyword/test_global.py | 37 | 4 | assert_* | test_global_keywords | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.wrong_keyword import (
WrongKeywordViolation,
WrongKeywordVisitor,
)
global_in_function = """
x = 0
def check_global():
global x
"""
nonlocal_in_function = """
def check_nonlocal():
j = 10
def nested():
nonloc... | [WrongKeywordViolation._code]) | added | 0ee34899518e8dd1c39fef9cf435d75b1fd3a16bacb7b093639be3173eb31e8c | assert_*|test_global_keywords|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.wrong_keyword import ( WrongKeywordViolation, WrongKeywordVisitor, ) global_in_function = """ x = 0 def check_global(): global x """ nonlocal_in_function = """ def check_nonlocal(): j = 10 def nested(): nonlocal j... | null | null | null |
wemake-services/wemake-python-styleguide | train | 7 | 4c0919e4bcb32f2b13baf756b89d43b3f0d8b7ba | train | tests/test_visitors/test_wrong_keyword/test_pass.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_keyword/test_pass.py | 39 | 4 | assert_* | test_pass_keyword | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.wrong_keyword import (
WrongKeywordViolation,
WrongKeywordVisitor,
)
pass_function = """
def function():
pass
"""
pass_class = """
class Test:
pass
"""
pass_method = """
class Test:
def method(self):
pass
"""
... | [WrongKeywordViolation._code]) | added | 081608e0d79b4ca628667e1ddc6d53a83ad96c949ec3c92c5faa47c98f2517a4 | assert_*|test_pass_keyword|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.wrong_keyword import ( WrongKeywordViolation, WrongKeywordVisitor, ) pass_function = """ def function(): pass """ pass_class = """ class Test: pass """ pass_method = """ class Test: def method(self): pass """ @pytest... | null | null | null |
wemake-services/wemake-python-styleguide | train | 7 | 4c0919e4bcb32f2b13baf756b89d43b3f0d8b7ba | train | tests/test_visitors/test_wrong_keyword/test_raise_notimplemented.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_keyword/test_raise_notimplemented.py | 34 | 4 | assert_* | test_raise_not_implemented | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.wrong_keyword import (
RaiseNotImplementedViolation,
WrongRaiseVisitor,
)
raise_not_implemented = """
class CheckAbstractMethods():
def check_not_implemented(self):
raise NotImplemented()
"""
raise_not_implemented_type ... | [RaiseNotImplementedViolation._code]) | added | 62e2d4879e05b45e03de7a3d4373c791b71a6613c06ae07279f6dde468a3981d | assert_*|test_raise_not_implemented|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.wrong_keyword import ( RaiseNotImplementedViolation, WrongRaiseVisitor, ) raise_not_implemented = """ class CheckAbstractMethods(): def check_not_implemented(self): raise NotImplemented() """ raise_not_imple... | null | null | null |
wemake-services/wemake-python-styleguide | train | 8 | 113cb61eae03fdd893f670e4d46fbe7b891733ba | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 32 | 12 | assert | # -*- coding: utf-8 -*-
import ast
from textwrap import dedent
from typing import Sequence
import pytest
from wemake_python_styleguide.visitors.base.visitor import BaseNodeVisitor
@pytest.fixture(scope='session')
def parse_ast_tree():
"""Helper function to convert code to ast."""
def factory(code: str) -> ... | errors[index]._code | modified | dd406d9ba8b9bd2535cb2c59e12127edaa922d5687065e85fdee295aad059f85 | assert||# -*- coding: utf-8 -*- import ast from textwrap import dedent from typing import Sequence import pytest from wemake_python_styleguide.visitors.base.visitor import BaseNodeVisitor @pytest.fixture(scope='session') def parse_ast_tree(): """Helper function to convert code to ast.""" def factory(code: str) -> ast.A... | errors[index] | 32 | 12 | |
wemake-services/wemake-python-styleguide | train | 8 | 113cb61eae03fdd893f670e4d46fbe7b891733ba | train | tests/test_visitors/test_wrong_keyword/test_bare_raise.py | test | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_keyword/test_bare_raise.py | 31 | 4 | assert_* | test_bare_raise_keyword | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.wrong_keyword import (
BareRiseViolation,
WrongRaiseVisitor,
)
bare_raise_module = """
raise
"""
bare_raise_function = """
def function():
raise
"""
@pytest.mark.parametrize('code', [
bare_raise_module,
bare_raise_fun... | [BareRiseViolation]) | modified | eaa08ef954b2b5f32833629bd9ab6996c4583c0fd2b086d096c62ef120cae72a | assert_*|test_bare_raise_keyword|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.wrong_keyword import ( BareRiseViolation, WrongRaiseVisitor, ) bare_raise_module = """ raise """ bare_raise_function = """ def function(): raise """ @pytest.mark.parametrize('code', [ bare_raise_module, bare_ra... | [BareRiseViolation._code]) | 31 | 4 |
wemake-services/wemake-python-styleguide | train | 8 | 113cb61eae03fdd893f670e4d46fbe7b891733ba | train | tests/test_visitors/test_wrong_keyword/test_del.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_keyword/test_del.py | 21 | 4 | assert_* | test_del_keyword | # -*- coding: utf-8 -*-
from wemake_python_styleguide.visitors.wrong_keyword import (
WrongKeywordViolation,
WrongKeywordVisitor,
)
def test_del_keyword(assert_errors, parse_ast_tree):
"""Testing that `del` keyword is restricted."""
tree = parse_ast_tree("""
def check_del():
s = {'key': '... | [ WrongKeywordViolation, WrongKeywordViolation, ]) | modified | 66011b5c692bf6a5eeeb5898bdcda68bd5cf44996360b0edf7d4fe0cc63d9ca5 | assert_*|test_del_keyword|# -*- coding: utf-8 -*- from wemake_python_styleguide.visitors.wrong_keyword import ( WrongKeywordViolation, WrongKeywordVisitor, ) def test_del_keyword(assert_errors, parse_ast_tree): """Testing that `del` keyword is restricted.""" tree = parse_ast_tree(""" def check_del(): s = {'key': 'value... | [ WrongKeywordViolation._code, WrongKeywordViolation._code, ]) | 21 | 4 |
wemake-services/wemake-python-styleguide | train | 8 | 113cb61eae03fdd893f670e4d46fbe7b891733ba | train | tests/test_visitors/test_wrong_keyword/test_pass.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_keyword/test_pass.py | 39 | 4 | assert_* | test_pass_keyword | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.wrong_keyword import (
WrongKeywordViolation,
WrongKeywordVisitor,
)
pass_function = """
def function():
pass
"""
pass_class = """
class Test:
pass
"""
pass_method = """
class Test:
def method(self):
pass
"""
... | [WrongKeywordViolation]) | modified | fb61d49c00ef46bcda3743ef6d0ff130342282cd816a6b453acddbad349d7bb7 | assert_*|test_pass_keyword|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.wrong_keyword import ( WrongKeywordViolation, WrongKeywordVisitor, ) pass_function = """ def function(): pass """ pass_class = """ class Test: pass """ pass_method = """ class Test: def method(self): pass """ @pytest... | [WrongKeywordViolation._code]) | 39 | 4 |
wemake-services/wemake-python-styleguide | train | 8 | 113cb61eae03fdd893f670e4d46fbe7b891733ba | train | tests/test_visitors/test_wrong_keyword/test_raise_notimplemented.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_keyword/test_raise_notimplemented.py | 34 | 4 | assert_* | test_raise_not_implemented | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.wrong_keyword import (
RaiseNotImplementedViolation,
WrongRaiseVisitor,
)
raise_not_implemented = """
class CheckAbstractMethods():
def check_not_implemented(self):
raise NotImplemented()
"""
raise_not_implemented_type ... | [RaiseNotImplementedViolation]) | modified | 137e2340120e6ca3d99d91d4e1e3765506c8d68964ce518881526ccb140ac473 | assert_*|test_raise_not_implemented|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.wrong_keyword import ( RaiseNotImplementedViolation, WrongRaiseVisitor, ) raise_not_implemented = """ class CheckAbstractMethods(): def check_not_implemented(self): raise NotImplemented() """ raise_not_imple... | [RaiseNotImplementedViolation._code]) | 34 | 4 |
wemake-services/wemake-python-styleguide | train | 8 | 113cb61eae03fdd893f670e4d46fbe7b891733ba | train | tests/test_visitors/test_wrong_name/test_class_attributes.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_name/test_class_attributes.py | 42 | 4 | assert_* | test_wrong_attributes_names | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.visitors.wrong_name import (
BAD_VARIABLE_NAMES,
TooShortAttributeNameViolation,
TooShortVariableNameViolation,
WrongAttributeNameViolation,
WrongNameVisitor,
WrongVariableNameViolation,
)
static_attributes_tes... | [error]) | added | 51764ae82a68da4023c2bf41056b1ccc1451e13e4d42c1073fa842ea8e9a6ebd | assert_*|test_wrong_attributes_names|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.visitors.wrong_name import ( BAD_VARIABLE_NAMES, TooShortAttributeNameViolation, TooShortVariableNameViolation, WrongAttributeNameViolation, WrongNameVisitor, WrongVariableNameViolation, ) static_attri... | null | null | null |
wemake-services/wemake-python-styleguide | train | 8 | 113cb61eae03fdd893f670e4d46fbe7b891733ba | train | tests/test_visitors/test_wrong_name/test_function_args_names.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_name/test_function_args_names.py | 60 | 4 | assert_* | test_wrong_function_arguments | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.visitors.wrong_name import (
BAD_VARIABLE_NAMES,
TooShortArgumentNameViolation,
WrongArgumentNameViolation,
WrongNameVisitor,
)
function_test = """
def test({0}, {1}): ...
"""
method_test = """
class Input:
def va... | [ TooShortArgumentNameViolation, WrongArgumentNameViolation, ]) | added | 4bd34aa31487c386bdb29de1ba3cda0d029da564c9c8c715a7ddfba6f99d6f7c | assert_*|test_wrong_function_arguments|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.visitors.wrong_name import ( BAD_VARIABLE_NAMES, TooShortArgumentNameViolation, WrongArgumentNameViolation, WrongNameVisitor, ) function_test = """ def test({0}, {1}): ... """ method_test = """ class... | null | null | null |
wemake-services/wemake-python-styleguide | train | 8 | 113cb61eae03fdd893f670e4d46fbe7b891733ba | train | tests/test_visitors/test_wrong_name/test_function_names.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_name/test_function_names.py | 38 | 4 | assert_* | test_wrong_function_names | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.visitors.wrong_name import (
BAD_VARIABLE_NAMES,
TooShortFunctionNameViolation,
WrongFunctionNameViolation,
WrongNameVisitor,
)
function_bad_name = """
def {0}(): ...
"""
method_bad_name = """
class Input:
def {0}... | [WrongFunctionNameViolation]) | added | e17c9fac0ab01f5af4c9354f595457c1f0a2799915b521db84bba5df1908fca2 | assert_*|test_wrong_function_names|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.visitors.wrong_name import ( BAD_VARIABLE_NAMES, TooShortFunctionNameViolation, WrongFunctionNameViolation, WrongNameVisitor, ) function_bad_name = """ def {0}(): ... """ method_bad_name = """ class Inpu... | null | null | null |
wemake-services/wemake-python-styleguide | train | 9 | da1e0e2d434d2760361872ade6f5e826b7201ca8 | train | tests/test_visitors/test_wrong_function_call/test_wrong_function_calls.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_function_call/test_wrong_function_calls.py | 40 | 4 | assert_* | test_wrong_function_called | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.wrong_function_call import (
BAD_FUNCTIONS,
WrongFunctionCallViolation,
WrongFunctionCallVisitor,
)
regular_call = """
{0}(*args, **kwargs)
"""
assignment_call = """
test_result = {0}(*args, **kwargs)
"""
nested_function_call ... | [WrongFunctionCallViolation]) | added | 9f9cdc54a078edfb0584806266d711e11c27c8ae051555995a338e6ae807ffb0 | assert_*|test_wrong_function_called|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.wrong_function_call import ( BAD_FUNCTIONS, WrongFunctionCallViolation, WrongFunctionCallVisitor, ) regular_call = """ {0}(*args, **kwargs) """ assignment_call = """ test_result = {0}(*args, **kwargs) """ ne... | null | null | null |
wemake-services/wemake-python-styleguide | train | 9 | da1e0e2d434d2760361872ade6f5e826b7201ca8 | train | tests/test_visitors/test_wrong_import/test_dynamic_imports.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_import/test_dynamic_imports.py | 16 | 4 | assert_* | test_dynamic_import | # -*- coding: utf-8 -*-
from wemake_python_styleguide.visitors.wrong_import import (
DynamicImportViolation,
WrongImportVisitor,
)
def test_dynamic_import(assert_errors, parse_ast_tree):
"""Testing that relative to local folder imports are restricted."""
tree = parse_ast_tree("module = __import__('os... | [DynamicImportViolation]) | added | 65985fc445cda05e4d9a2d453a20cdeb51a0fa3bc259cb81085586e0e1afd32d | assert_*|test_dynamic_import|# -*- coding: utf-8 -*- from wemake_python_styleguide.visitors.wrong_import import ( DynamicImportViolation, WrongImportVisitor, ) def test_dynamic_import(assert_errors, parse_ast_tree): """Testing that relative to local folder imports are restricted.""" tree = parse_ast_tree("module = __im... | null | null | null |
wemake-services/wemake-python-styleguide | train | 9 | da1e0e2d434d2760361872ade6f5e826b7201ca8 | train | tests/test_visitors/test_wrong_import/test_nested_imports.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_import/test_nested_imports.py | 46 | 4 | assert_* | test_nested_import | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.wrong_import import (
NestedImportViolation,
WrongImportVisitor,
)
nested_function_import = """
def function():
import os
"""
nested_function_from_import = """
def function():
from os import path
"""
nested_method_import =... | [NestedImportViolation]) | added | 14d19544c5ae6d45b317d6a80c441595cd6258b8ad224d0bdca26eae428fc665 | assert_*|test_nested_import|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.wrong_import import ( NestedImportViolation, WrongImportVisitor, ) nested_function_import = """ def function(): import os """ nested_function_from_import = """ def function(): from os import path """ nested_method_i... | null | null | null |
wemake-services/wemake-python-styleguide | train | 9 | da1e0e2d434d2760361872ade6f5e826b7201ca8 | train | tests/test_visitors/test_wrong_import/test_relative_imports.py | test | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_import/test_relative_imports.py | 40 | 4 | assert_* | test_local_folder_import | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.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 = ... | [LocalFolderImportViolation]) | added | 741d3be9e0345009959a0a8b91270364c22f6247d96435195c1471c364091f3b | assert_*|test_local_folder_import|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.wrong_import import ( LocalFolderImportViolation, WrongImportVisitor, ) same_level_relative_import = """ from . import some """ same_level_relative_import_sibling = """ from .some import MyClass """ parent_lev... | null | null | null |
wemake-services/wemake-python-styleguide | train | 9 | da1e0e2d434d2760361872ade6f5e826b7201ca8 | train | tests/test_visitors/test_wrong_name/test_class_attributes.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_name/test_class_attributes.py | 42 | 4 | assert_* | test_wrong_attributes_names | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.visitors.wrong_name import (
BAD_VARIABLE_NAMES,
TooShortAttributeNameViolation,
TooShortVariableNameViolation,
WrongAttributeNameViolation,
WrongNameVisitor,
WrongVariableNameViolation,
)
static_attribute = ""... | [error]) | modified | bac53aa3c5058c968ad6c96eea170a2873dd35dcbfd5de2c6e1f8164972dfed0 | assert_*|test_wrong_attributes_names|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.visitors.wrong_name import ( BAD_VARIABLE_NAMES, TooShortAttributeNameViolation, TooShortVariableNameViolation, WrongAttributeNameViolation, WrongNameVisitor, WrongVariableNameViolation, ) static_attri... | [error]) | 42 | 4 |
wemake-services/wemake-python-styleguide | train | 9 | da1e0e2d434d2760361872ade6f5e826b7201ca8 | train | tests/test_visitors/test_wrong_name/test_class_attributes.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_name/test_class_attributes.py | 59 | 4 | assert_* | test_too_short_attribute_names | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.visitors.wrong_name import (
BAD_VARIABLE_NAMES,
TooShortAttributeNameViolation,
TooShortVariableNameViolation,
WrongAttributeNameViolation,
WrongNameVisitor,
WrongVariableNameViolation,
)
static_attribute = ""... | [error]) | modified | 6cd76760fe54e59460e7a7471301afc69f7f31634b1b10d25c535b4747ebb33c | assert_*|test_too_short_attribute_names|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.visitors.wrong_name import ( BAD_VARIABLE_NAMES, TooShortAttributeNameViolation, TooShortVariableNameViolation, WrongAttributeNameViolation, WrongNameVisitor, WrongVariableNameViolation, ) static_at... | [error]) | 59 | 4 |
wemake-services/wemake-python-styleguide | train | 9 | da1e0e2d434d2760361872ade6f5e826b7201ca8 | train | tests/test_visitors/test_wrong_nested/test_nested_classes.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_nested/test_nested_classes.py | 76 | 4 | assert_* | test_whitelist_nested_classes_in_functions | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.wrong_nested import (
NESTED_CLASSES_WHITELIST,
NestedClassViolation,
WrongNestedVisitor,
)
nested_class = """
class Parent:
class {0}: ...
"""
nested_class_in_method = """
class Parent:
def container(self):
cla... | [NestedClassViolation]) | added | 5fa009d3b42eef1c6382427a67118bec06771f2de25b7d22aa7fa9540ba8bf05 | assert_*|test_whitelist_nested_classes_in_functions|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.wrong_nested import ( NESTED_CLASSES_WHITELIST, NestedClassViolation, WrongNestedVisitor, ) nested_class = """ class Parent: class {0}: ... """ nested_class_in_method = """ class Parent: def ... | null | null | null |
wemake-services/wemake-python-styleguide | train | 9 | da1e0e2d434d2760361872ade6f5e826b7201ca8 | train | tests/test_visitors/test_wrong_nested/test_nested_functions.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_nested/test_nested_functions.py | 34 | 4 | assert_* | test_nested_function | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.wrong_nested import (
NESTED_FUNCTIONS_WHITELIST,
NestedFunctionViolation,
WrongNestedVisitor,
)
nested_function = """
def container():
def {0}(): ...
"""
nested_method = """
class Raw:
def container(self):
def ... | [NestedFunctionViolation]) | added | 5b9cb9abbceff7899b13ed48d624bb7540550c8617fa421db6932480e9c3352b | assert_*|test_nested_function|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.wrong_nested import ( NESTED_FUNCTIONS_WHITELIST, NestedFunctionViolation, WrongNestedVisitor, ) nested_function = """ def container(): def {0}(): ... """ nested_method = """ class Raw: def container(self): def {0... | null | null | null |
wemake-services/wemake-python-styleguide | train | 10 | f743b96a24c55e90d5d3269dbeecdb31c4c7e19d | train | tests/test_visitors/test_wrong_name/test_variable_names.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_name/test_variable_names.py | 72 | 4 | assert_* | test_wrong_variable_names | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.visitors.wrong_name import (
BAD_VARIABLE_NAMES,
TooShortVariableNameViolation,
WrongNameVisitor,
WrongVariableNameViolation,
)
variable_test = """
{0} = 'test'
"""
underscore_variable_test1 = """
_{0} = 'test'
"""
u... | [WrongVariableNameViolation]) | added | d5fac9814e2ba4071056d320a16f8d3f444aea869c3ec814adf7486bd22559d6 | assert_*|test_wrong_variable_names|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.visitors.wrong_name import ( BAD_VARIABLE_NAMES, TooShortVariableNameViolation, WrongNameVisitor, WrongVariableNameViolation, ) variable_test = """ {0} = 'test' """ underscore_variable_test1 = """ _{0} =... | null | null | null |
wemake-services/wemake-python-styleguide | train | 10 | f743b96a24c55e90d5d3269dbeecdb31c4c7e19d | train | tests/test_visitors/test_wrong_name/test_variable_names.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_name/test_variable_names.py | 91 | 4 | assert_* | test_too_short_variable_names | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.visitors.wrong_name import (
BAD_VARIABLE_NAMES,
TooShortVariableNameViolation,
WrongNameVisitor,
WrongVariableNameViolation,
)
variable_test = """
{0} = 'test'
"""
underscore_variable_test1 = """
_{0} = 'test'
"""
u... | [TooShortVariableNameViolation]) | added | c2c97dee22f5c175dc1e02fc5bf20f3c3e0c4b6adbffeaf200db9dd96c109552 | assert_*|test_too_short_variable_names|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.visitors.wrong_name import ( BAD_VARIABLE_NAMES, TooShortVariableNameViolation, WrongNameVisitor, WrongVariableNameViolation, ) variable_test = """ {0} = 'test' """ underscore_variable_test1 = """ _{... | null | null | null |
wemake-services/wemake-python-styleguide | train | 12 | 764940d0ec6baead14e20e9fac04900aaf77bce4 | train | tests/test_errors.py | test | wemake-services/wemake-python-styleguide:tests/test_errors.py | 33 | 4 | assert | test_all_unique_error_codes | # -*- coding: utf-8 -*-
import inspect
from operator import itemgetter
import pytest
from wemake_python_styleguide import errors
def _is_error_class(cls) -> bool:
return (
inspect.isclass(cls) and
issubclass(cls, errors.BaseStyleViolation) and
cls is not errors.BaseStyleViolation
)
... | len(all_errors) | added | 911241f648deb338fb4104c957fc547d2cbecd314592ff5f370f8b197ade312c | assert|test_all_unique_error_codes|# -*- coding: utf-8 -*- import inspect from operator import itemgetter import pytest from wemake_python_styleguide import errors def _is_error_class(cls) -> bool: return ( inspect.isclass(cls) and issubclass(cls, errors.BaseStyleViolation) and cls is not errors.BaseStyleViolation ) @p... | null | null | null |
wemake-services/wemake-python-styleguide | train | 12 | 764940d0ec6baead14e20e9fac04900aaf77bce4 | train | tests/test_version.py | train | wemake-services/wemake-python-styleguide:tests/test_version.py | 12 | 4 | assert | test_call_flake8_version | # -*- coding: utf-8 -*-
import subprocess
def test_call_flake8_version():
"""Checks that module is registered and visible in the meta data."""
output = subprocess.check_output(
['flake8', '--version'],
stderr=subprocess.STDOUT,
)
assert b'wemake-python-styleguide' in | output | added | daf2f994785f6d22ab813a1d1072f85840859bd1e02db9b99712b83770d9313b | assert|test_call_flake8_version|# -*- coding: utf-8 -*- import subprocess def test_call_flake8_version(): """Checks that module is registered and visible in the meta data.""" output = subprocess.check_output( ['flake8', '--version'], stderr=subprocess.STDOUT, ) assert b'wemake-python-styleguide' in | null | null | null |
wemake-services/wemake-python-styleguide | train | 12 | 764940d0ec6baead14e20e9fac04900aaf77bce4 | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 32 | 12 | assert | # -*- coding: utf-8 -*-
import ast
from textwrap import dedent
from typing import Sequence
import pytest
from wemake_python_styleguide.visitors.base.visitor import BaseNodeVisitor
@pytest.fixture(scope='session')
def parse_ast_tree():
"""Helper function to convert code to ast."""
def factory(code: str) -> ... | index | added | 134b9fd92f1b050d9d6aa8b05b8df71b2c38dcfb37ce186a40596d848b641c45 | assert||# -*- coding: utf-8 -*- import ast from textwrap import dedent from typing import Sequence import pytest from wemake_python_styleguide.visitors.base.visitor import BaseNodeVisitor @pytest.fixture(scope='session') def parse_ast_tree(): """Helper function to convert code to ast.""" def factory(code: str) -> ast.A... | null | null | null | |
wemake-services/wemake-python-styleguide | train | 12 | 764940d0ec6baead14e20e9fac04900aaf77bce4 | train | tests/test_visitors/test_wrong_import/test_nested_imports.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_import/test_nested_imports.py | 72 | 4 | assert_* | test_nested_import | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.wrong_import import (
NestedImportViolation,
WrongImportVisitor,
)
# Incorrect imports:
nested_function_import = """
def function():
import os
"""
nested_function_from_import = """
def function():
from os import path
"""
... | [NestedImportViolation]) | added | c54808e025cfbe10c35cb106c4db04cbd752fcb6dc728096849ce95e82738f56 | assert_*|test_nested_import|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.wrong_import import ( NestedImportViolation, WrongImportVisitor, ) # Incorrect imports: nested_function_import = """ def function(): import os """ nested_function_from_import = """ def function(): from os import pat... | null | null | null |
wemake-services/wemake-python-styleguide | train | 12 | 764940d0ec6baead14e20e9fac04900aaf77bce4 | train | tests/test_visitors/test_wrong_name/test_class_attributes.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_name/test_class_attributes.py | 41 | 4 | assert_* | test_wrong_attributes_names | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.visitors.wrong_name import (
BAD_VARIABLE_NAMES,
PrivateNameViolation,
TooShortVariableNameViolation,
WrongNameVisitor,
WrongVariableNameViolation,
)
static_attribute = """
class Test:
{0} = None
"""
instance_... | [WrongVariableNameViolation]) | added | 7bf2482143472a67ac0065c03ff80cdfb4c2bc35e5e46ee57e79f564cb3a6865 | assert_*|test_wrong_attributes_names|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.visitors.wrong_name import ( BAD_VARIABLE_NAMES, PrivateNameViolation, TooShortVariableNameViolation, WrongNameVisitor, WrongVariableNameViolation, ) static_attribute = """ class Test: {0} = None """ i... | null | null | null |
wemake-services/wemake-python-styleguide | train | 12 | 764940d0ec6baead14e20e9fac04900aaf77bce4 | train | tests/test_visitors/test_wrong_name/test_function_args_names.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_name/test_function_args_names.py | 61 | 4 | assert_* | test_wrong_function_arguments | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.visitors.wrong_name import (
BAD_VARIABLE_NAMES,
PrivateNameViolation,
TooShortVariableNameViolation,
WrongNameVisitor,
WrongVariableNameViolation,
)
function_test = """
def test({0}, {1}): ...
"""
method_test = "... | [ TooShortVariableNameViolation, WrongVariableNameViolation, ]) | modified | 2eada94a98dc64cec34b943a999c546f9ef4074eddb89739da4423ac4a3f55bf | assert_*|test_wrong_function_arguments|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.visitors.wrong_name import ( BAD_VARIABLE_NAMES, PrivateNameViolation, TooShortVariableNameViolation, WrongNameVisitor, WrongVariableNameViolation, ) function_test = """ def test({0}, {1}): ... """ m... | [ TooShortArgumentNameViolation, WrongArgumentNameViolation, ]) | 60 | 4 |
wemake-services/wemake-python-styleguide | train | 12 | 764940d0ec6baead14e20e9fac04900aaf77bce4 | train | tests/test_visitors/test_wrong_name/test_function_names.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_name/test_function_names.py | 72 | 4 | assert_* | test_private_function_names | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.visitors.wrong_name import (
BAD_VARIABLE_NAMES,
PrivateNameViolation,
TooShortVariableNameViolation,
WrongNameVisitor,
WrongVariableNameViolation,
)
function_bad_name = """
def {0}(): ...
"""
method_bad_name = ""... | [PrivateNameViolation]) | added | a9fd176ef06c3fee1440e1e609ce3a732a7faf9ad7c3aba373e42ef9be36dc71 | assert_*|test_private_function_names|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.visitors.wrong_name import ( BAD_VARIABLE_NAMES, PrivateNameViolation, TooShortVariableNameViolation, WrongNameVisitor, WrongVariableNameViolation, ) function_bad_name = """ def {0}(): ... """ method_b... | null | null | null |
wemake-services/wemake-python-styleguide | train | 12 | 764940d0ec6baead14e20e9fac04900aaf77bce4 | train | tests/test_visitors/test_wrong_name/test_variable_names.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_name/test_variable_names.py | 82 | 4 | assert_* | test_too_short_variable_names | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.visitors.wrong_name import (
BAD_VARIABLE_NAMES,
PrivateNameViolation,
TooShortVariableNameViolation,
WrongNameVisitor,
WrongVariableNameViolation,
)
variable_test = """
{0} = 'test'
"""
underscore_variable_test1 ... | [TooShortVariableNameViolation]) | added | 20757ac30127c0ed0d321aba5ef6d0e649ab370b306669300856e6148eaab6a1 | assert_*|test_too_short_variable_names|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.visitors.wrong_name import ( BAD_VARIABLE_NAMES, PrivateNameViolation, TooShortVariableNameViolation, WrongNameVisitor, WrongVariableNameViolation, ) variable_test = """ {0} = 'test' """ underscore_v... | null | null | null |
wemake-services/wemake-python-styleguide | train | 13 | 1f80474611064006ddd473a9042a45e861c8a8ad | train | tests/test_errors.py | test | wemake-services/wemake-python-styleguide:tests/test_errors.py | 10 | 4 | assert | test_all_unique_error_codes | # -*- coding: utf-8 -*-
def test_all_unique_error_codes(all_errors):
"""Ensures that all errors have unique error codes."""
codes = []
for error in all_errors:
codes.append(error._code)
assert len(set(codes)) == | len(all_errors) | added | 2d10825fc161e740802eed6be41bd306711073a7c9b21eb2f0fb9e464c1b9994 | assert|test_all_unique_error_codes|# -*- coding: utf-8 -*- def test_all_unique_error_codes(all_errors): """Ensures that all errors have unique error codes.""" codes = [] for error in all_errors: codes.append(error._code) assert len(set(codes)) == | null | null | null |
wemake-services/wemake-python-styleguide | train | 13 | 1f80474611064006ddd473a9042a45e861c8a8ad | train | tests/test_errors.py | test | wemake-services/wemake-python-styleguide:tests/test_errors.py | 16 | 8 | assert | test_all_errors_have_description_with_code | # -*- coding: utf-8 -*-
def test_all_unique_error_codes(all_errors):
"""Ensures that all errors have unique error codes."""
codes = []
for error in all_errors:
codes.append(error._code)
assert len(set(codes)) == len(all_errors)
def test_all_errors_have_description_with_code(all_errors):
... | error.__doc__ | added | 32049b5370612d3da361a64b7db65d6d2c7abfc19208291af8b1ff3c0407058d | assert|test_all_errors_have_description_with_code|# -*- coding: utf-8 -*- def test_all_unique_error_codes(all_errors): """Ensures that all errors have unique error codes.""" codes = [] for error in all_errors: codes.append(error._code) assert len(set(codes)) == len(all_errors) def test_all_errors_have_description_with_... | null | null | null |
wemake-services/wemake-python-styleguide | train | 13 | 1f80474611064006ddd473a9042a45e861c8a8ad | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 27 | 12 | assert | # -*- coding: utf-8 -*-
import ast
from textwrap import dedent
from typing import Sequence
import pytest
from wemake_python_styleguide.compat import maybe_set_parent
from wemake_python_styleguide.visitors.base.visitor import BaseNodeVisitor
@pytest.fixture(scope='session')
def parse_ast_tree():
"""Helper funct... | index | added | 31bc898b7355f6835925679f69cf802e84fe9cb4cb5e6e149024175727718c55 | assert||# -*- coding: utf-8 -*- import ast from textwrap import dedent from typing import Sequence import pytest from wemake_python_styleguide.compat import maybe_set_parent from wemake_python_styleguide.visitors.base.visitor import BaseNodeVisitor @pytest.fixture(scope='session') def parse_ast_tree(): """Helper functi... | null | null | null | |
wemake-services/wemake-python-styleguide | train | 13 | 1f80474611064006ddd473a9042a45e861c8a8ad | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 28 | 12 | assert | # -*- coding: utf-8 -*-
import ast
from textwrap import dedent
from typing import Sequence
import pytest
from wemake_python_styleguide.compat import maybe_set_parent
from wemake_python_styleguide.visitors.base.visitor import BaseNodeVisitor
@pytest.fixture(scope='session')
def parse_ast_tree():
"""Helper funct... | errors[index]._code | added | d9076d65012a1455c888d5d44fdd064e0ff492090eb7d01705dd43520d5bd33f | assert||# -*- coding: utf-8 -*- import ast from textwrap import dedent from typing import Sequence import pytest from wemake_python_styleguide.compat import maybe_set_parent from wemake_python_styleguide.visitors.base.visitor import BaseNodeVisitor @pytest.fixture(scope='session') def parse_ast_tree(): """Helper functi... | null | null | null | |
wemake-services/wemake-python-styleguide | train | 13 | 1f80474611064006ddd473a9042a45e861c8a8ad | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 30 | 8 | assert | # -*- coding: utf-8 -*-
import ast
from textwrap import dedent
from typing import Sequence
import pytest
from wemake_python_styleguide.compat import maybe_set_parent
from wemake_python_styleguide.visitors.base.visitor import BaseNodeVisitor
@pytest.fixture(scope='session')
def parse_ast_tree():
"""Helper funct... | len(errors) | added | 78bc513653a811e80296860ca1e334fdf18b7601bb379fa4f7e6979aaab9924e | assert||# -*- coding: utf-8 -*- import ast from textwrap import dedent from typing import Sequence import pytest from wemake_python_styleguide.compat import maybe_set_parent from wemake_python_styleguide.visitors.base.visitor import BaseNodeVisitor @pytest.fixture(scope='session') def parse_ast_tree(): """Helper functi... | null | null | null | |
wemake-services/wemake-python-styleguide | train | 14 | d5f7668a02de2ed812b72151077bbd418d24adcf | train | tests/test_visitors/test_wrong_class/test_base_class.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_class/test_base_class.py | 20 | 4 | assert_* | test_wrong_base_class | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.wrong_class import (
RequiredBaseClassViolation,
WrongClassVisitor,
)
def test_wrong_base_class(assert_errors, parse_ast_tree):
"""Testing that not using explicit base class with forbiden."""
tree = parse_ast_tree("""
c... | [RequiredBaseClassViolation]) | added | 0e2c8f322db5a8a48ce5b6c5a0b7c0965ed90c163dc18f5b36c0eb444ef520fd | assert_*|test_wrong_base_class|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.wrong_class import ( RequiredBaseClassViolation, WrongClassVisitor, ) def test_wrong_base_class(assert_errors, parse_ast_tree): """Testing that not using explicit base class with forbiden.""" tree = parse_ast_tre... | null | null | null |
wemake-services/wemake-python-styleguide | train | 14 | d5f7668a02de2ed812b72151077bbd418d24adcf | train | tests/test_visitors/test_wrong_class/test_magic_methods.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_class/test_magic_methods.py | 25 | 4 | assert_* | test_wrong_magic_used | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.constants import BAD_MAGIC_METHODS
from wemake_python_styleguide.visitors.wrong_class import (
BadMagicMethodViolation,
WrongClassVisitor,
)
magic_method = """
class Example(object):
def {0}(): ...
"""
@pytest.mark.parametrize('method'... | [BadMagicMethodViolation]) | added | 3f61befdf9b97673468c7bd03bc60e5119f73e5db2004293ba9ac0e16a0a1b7d | assert_*|test_wrong_magic_used|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.constants import BAD_MAGIC_METHODS from wemake_python_styleguide.visitors.wrong_class import ( BadMagicMethodViolation, WrongClassVisitor, ) magic_method = """ class Example(object): def {0}(): ... """ @pytest.mark.parame... | null | null | null |
wemake-services/wemake-python-styleguide | train | 14 | d5f7668a02de2ed812b72151077bbd418d24adcf | train | tests/test_visitors/test_wrong_class/test_staticmethod.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_class/test_staticmethod.py | 24 | 4 | assert_* | test_staticmethod_used | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.wrong_class import (
StaticMethodViolation,
WrongClassVisitor,
)
decorated_method = """
class Example(object):
@{0}
def should_fail(): ...
"""
def test_staticmethod_used(assert_errors, parse_ast_tree):
"""Testing that ... | [StaticMethodViolation]) | added | d2075f65f5a4669e58808c3559a75620989762ecc2564877bf42b31335a42007 | assert_*|test_staticmethod_used|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.wrong_class import ( StaticMethodViolation, WrongClassVisitor, ) decorated_method = """ class Example(object): @{0} def should_fail(): ... """ def test_staticmethod_used(assert_errors, parse_ast_tree): """Testin... | null | null | null |
wemake-services/wemake-python-styleguide | train | 14 | d5f7668a02de2ed812b72151077bbd418d24adcf | train | tests/test_visitors/test_wrong_function_call/test_wrong_function_calls.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_function_call/test_wrong_function_calls.py | 52 | 4 | assert_* | test_wrong_decorator_used | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.wrong_function_call import (
BAD_FUNCTIONS,
WrongFunctionCallViolation,
WrongFunctionCallVisitor,
)
regular_call = """
{0}(*args, **kwargs)
"""
assignment_call = """
test_result = {0}(*args, **kwargs)
"""
nested_function_call ... | [WrongFunctionCallViolation]) | added | 8bbd03d00e54daaedfef4fdfbd614eca06ace54fbb461a444b2b3546c3fe9a7d | assert_*|test_wrong_decorator_used|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.wrong_function_call import ( BAD_FUNCTIONS, WrongFunctionCallViolation, WrongFunctionCallVisitor, ) regular_call = """ {0}(*args, **kwargs) """ assignment_call = """ test_result = {0}(*args, **kwargs) """ nes... | null | null | null |
wemake-services/wemake-python-styleguide | train | 14 | d5f7668a02de2ed812b72151077bbd418d24adcf | train | tests/test_visitors/test_wrong_import/test_future_imports.py | test | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_import/test_future_imports.py | 35 | 4 | assert_* | test_wrong_future_import | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.constants import FUTURE_IMPORTS_WHITELIST
from wemake_python_styleguide.visitors.wrong_import import (
FutureImportViolation,
WrongImportVisitor,
)
future_import = """
from __future__ import {0}
"""
future_import_alias = """
from __future__... | [FutureImportViolation]) | added | 5be4a935de48f4738e7d8cb6ce8ff36b0fae6769e75dc8f1ed86521441f8adec | assert_*|test_wrong_future_import|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.constants import FUTURE_IMPORTS_WHITELIST from wemake_python_styleguide.visitors.wrong_import import ( FutureImportViolation, WrongImportVisitor, ) future_import = """ from __future__ import {0} """ future_import_alias... | null | null | null |
wemake-services/wemake-python-styleguide | train | 14 | d5f7668a02de2ed812b72151077bbd418d24adcf | train | tests/test_visitors/test_wrong_import/test_future_imports.py | test | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_import/test_future_imports.py | 47 | 4 | assert_* | test_wrong_multiple_future_import | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.constants import FUTURE_IMPORTS_WHITELIST
from wemake_python_styleguide.visitors.wrong_import import (
FutureImportViolation,
WrongImportVisitor,
)
future_import = """
from __future__ import {0}
"""
future_import_alias = """
from __future__... | [FutureImportViolation, FutureImportViolation]) | added | e702a192826123d2af451a7beb11f3f230b6a89a9b5b021addfc51e216da57a8 | assert_*|test_wrong_multiple_future_import|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.constants import FUTURE_IMPORTS_WHITELIST from wemake_python_styleguide.visitors.wrong_import import ( FutureImportViolation, WrongImportVisitor, ) future_import = """ from __future__ import {0} """ future_imp... | null | null | null |
wemake-services/wemake-python-styleguide | train | 15 | d676174f62bd28894ce54f733c6d8f6e549e62cb | train | tests/test_visitors/test_wrong_import/test_dotted_raw_import.py | test | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_import/test_dotted_raw_import.py | 42 | 4 | assert_* | test_wrong_dotted_import | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.wrong_import import (
DottedRawImportViolation,
WrongImportVisitor,
)
regular_import = """
import {0}
"""
regular_import_with_alias = """
import {0} as alias
"""
from_import = """
from {0} import some
"""
from_import_with_alias =... | [DottedRawImportViolation]) | added | 6e7bcb74b80a8436fbaf5183791fb1e0deb0fde4e62dbcfd3753c283003254ee | assert_*|test_wrong_dotted_import|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.wrong_import import ( DottedRawImportViolation, WrongImportVisitor, ) regular_import = """ import {0} """ regular_import_with_alias = """ import {0} as alias """ from_import = """ from {0} import some """ from... | null | null | null |
wemake-services/wemake-python-styleguide | train | 15 | d676174f62bd28894ce54f733c6d8f6e549e62cb | train | tests/test_visitors/test_wrong_name/test_function_names.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_name/test_function_names.py | 72 | 4 | assert_* | test_private_function_names | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.visitors.wrong_name import (
BAD_VARIABLE_NAMES,
PrivateNameViolation,
TooShortVariableNameViolation,
WrongNameVisitor,
WrongVariableNameViolation,
)
function_bad_name = """
def {0}(): ...
"""
method_bad_name = ""... | [PrivateNameViolation]) | modified | 149ad5fbf192930cc8613c543832317fc66024edea5ba5f407247cc732bf7da8 | assert_*|test_private_function_names|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.visitors.wrong_name import ( BAD_VARIABLE_NAMES, PrivateNameViolation, TooShortVariableNameViolation, WrongNameVisitor, WrongVariableNameViolation, ) function_bad_name = """ def {0}(): ... """ method_b... | [PrivateNameViolation]) | 72 | 4 |
wemake-services/wemake-python-styleguide | train | 15 | d676174f62bd28894ce54f733c6d8f6e549e62cb | train | tests/test_visitors/test_wrong_name/test_import_alias.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_name/test_import_alias.py | 38 | 4 | assert_* | test_wrong_import_alias_names | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.visitors.wrong_name import (
BAD_VARIABLE_NAMES,
PrivateNameViolation,
TooShortVariableNameViolation,
WrongNameVisitor,
WrongVariableNameViolation,
)
import_alias = """
import os as {0}
"""
from_import_alias = """... | [WrongVariableNameViolation]) | added | f1c119906e12af681aac5e9ac11cf9828183158ab7c398693c9dd35f0216a938 | assert_*|test_wrong_import_alias_names|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.visitors.wrong_name import ( BAD_VARIABLE_NAMES, PrivateNameViolation, TooShortVariableNameViolation, WrongNameVisitor, WrongVariableNameViolation, ) import_alias = """ import os as {0} """ from_impo... | null | null | null |
wemake-services/wemake-python-styleguide | train | 15 | d676174f62bd28894ce54f733c6d8f6e549e62cb | train | tests/test_visitors/test_wrong_name/test_import_alias.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_name/test_import_alias.py | 55 | 4 | assert_* | test_too_short_import_alias_names | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.visitors.wrong_name import (
BAD_VARIABLE_NAMES,
PrivateNameViolation,
TooShortVariableNameViolation,
WrongNameVisitor,
WrongVariableNameViolation,
)
import_alias = """
import os as {0}
"""
from_import_alias = """... | [TooShortVariableNameViolation]) | added | 153cd1d9078c4d54716b16930a12332e70b21ef40bfe85d9943847159800e0be | assert_*|test_too_short_import_alias_names|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.visitors.wrong_name import ( BAD_VARIABLE_NAMES, PrivateNameViolation, TooShortVariableNameViolation, WrongNameVisitor, WrongVariableNameViolation, ) import_alias = """ import os as {0} """ from_... | null | null | null |
wemake-services/wemake-python-styleguide | train | 15 | d676174f62bd28894ce54f733c6d8f6e549e62cb | train | tests/test_visitors/test_wrong_name/test_import_alias.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_name/test_import_alias.py | 71 | 4 | assert_* | test_private_import_alias_names | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.visitors.wrong_name import (
BAD_VARIABLE_NAMES,
PrivateNameViolation,
TooShortVariableNameViolation,
WrongNameVisitor,
WrongVariableNameViolation,
)
import_alias = """
import os as {0}
"""
from_import_alias = """... | [PrivateNameViolation]) | added | ebe1d5f96d2f01ed23a425e66f6856f9c2a6f6b765e7ce41c256dedde3bfa834 | assert_*|test_private_import_alias_names|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.visitors.wrong_name import ( BAD_VARIABLE_NAMES, PrivateNameViolation, TooShortVariableNameViolation, WrongNameVisitor, WrongVariableNameViolation, ) import_alias = """ import os as {0} """ from_im... | null | null | null |
wemake-services/wemake-python-styleguide | train | 16 | c5bbeef26dfcc6b069ad337732fc9e746b4c716d | train | tests/test_visitors/test_high_complexity/test_local_variables.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/test_high_complexity/test_local_variables.py | 74 | 4 | assert_* | test_locals_wrong_count | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.high_complexity import (
ComplexityVisitor,
TooManyLocalsViolation,
)
function_with_locals = """
def function():
local_variable1 = 1
local_variable2 = 2
"""
function_with_locals_redefinition = """
def function():
local_... | [TooManyLocalsViolation]) | added | 2a1ce38be56e27696e5a92a98d292c08e5976f7d683fe7213069696c6c221101 | assert_*|test_locals_wrong_count|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.high_complexity import ( ComplexityVisitor, TooManyLocalsViolation, ) function_with_locals = """ def function(): local_variable1 = 1 local_variable2 = 2 """ function_with_locals_redefinition = """ def function(... | null | null | null |
wemake-services/wemake-python-styleguide | train | 16 | c5bbeef26dfcc6b069ad337732fc9e746b4c716d | train | tests/test_visitors/test_wrong_import/test_same_alias_import.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_import/test_same_alias_import.py | 30 | 4 | assert_* | test_same_alias_import | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.wrong_import import (
SameAliasImportViolation,
WrongImportVisitor,
)
regular_import = """
import os as {0}
"""
from_import = """
from sys import os as {0}
"""
@pytest.mark.parametrize('code', [
regular_import,
from_impor... | [SameAliasImportViolation]) | added | e7cc932a7cc6fcb0878116b9c85045f26a04f9406c8e296f1630478cf17c01b2 | assert_*|test_same_alias_import|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.wrong_import import ( SameAliasImportViolation, WrongImportVisitor, ) regular_import = """ import os as {0} """ from_import = """ from sys import os as {0} """ @pytest.mark.parametrize('code', [ regular_import, ... | null | null | null |
wemake-services/wemake-python-styleguide | train | 17 | 7673dd2896f14dca7be2c7c63147eccd29d59fad | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 28 | 12 | assert | # -*- coding: utf-8 -*-
import ast
from textwrap import dedent
from typing import Sequence
import pytest
from wemake_python_styleguide.compat import maybe_set_parent
from wemake_python_styleguide.visitors.base.visitor import BaseNodeVisitor
@pytest.fixture(scope='session')
def parse_ast_tree():
"""Helper funct... | errors[index]._code | modified | 694db2d45eb1f22eebcd71d3b431b166a2270ce14866fafe112cb68bb9374484 | assert||# -*- coding: utf-8 -*- import ast from textwrap import dedent from typing import Sequence import pytest from wemake_python_styleguide.compat import maybe_set_parent from wemake_python_styleguide.visitors.base.visitor import BaseNodeVisitor @pytest.fixture(scope='session') def parse_ast_tree(): """Helper functi... | errors[index]._code | 28 | 12 | |
wemake-services/wemake-python-styleguide | train | 17 | 7673dd2896f14dca7be2c7c63147eccd29d59fad | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 30 | 8 | assert | # -*- coding: utf-8 -*-
import ast
from textwrap import dedent
from typing import Sequence
import pytest
from wemake_python_styleguide.compat import maybe_set_parent
from wemake_python_styleguide.visitors.base.visitor import BaseNodeVisitor
@pytest.fixture(scope='session')
def parse_ast_tree():
"""Helper funct... | len(errors) | modified | 2496f9b449e69eb0040da99cf408661dc75b298e225976776770db94e478c958 | assert||# -*- coding: utf-8 -*- import ast from textwrap import dedent from typing import Sequence import pytest from wemake_python_styleguide.compat import maybe_set_parent from wemake_python_styleguide.visitors.base.visitor import BaseNodeVisitor @pytest.fixture(scope='session') def parse_ast_tree(): """Helper functi... | len(errors) | 30 | 8 | |
wemake-services/wemake-python-styleguide | train | 17 | 7673dd2896f14dca7be2c7c63147eccd29d59fad | train | tests/test_visitors/test_complexity/test_function/test_local_variables.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_complexity/test_function/test_local_variables.py | 75 | 4 | assert_* | test_locals_wrong_count | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.complexity.function import (
FunctionComplexityVisitor,
TooManyLocalsViolation,
)
function_with_locals = """
def function():
local_variable1 = 1
local_variable2 = 2
_ = None # `_` is not counted
"""
function_with_local... | [TooManyLocalsViolation]) | modified | 526cd4dd291ddebba83ab5234c98506ca6a2fca3fcd4fb4a14c8c69ae69baa11 | assert_*|test_locals_wrong_count|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.complexity.function import ( FunctionComplexityVisitor, TooManyLocalsViolation, ) function_with_locals = """ def function(): local_variable1 = 1 local_variable2 = 2 _ = None # `_` is not counted """ function_wi... | [TooManyLocalsViolation]) | 74 | 4 |
wemake-services/wemake-python-styleguide | train | 17 | 7673dd2896f14dca7be2c7c63147eccd29d59fad | train | tests/test_visitors/test_complexity/test_nested/test_nested_classes.py | test | wemake-services/wemake-python-styleguide:tests/test_visitors/test_complexity/test_nested/test_nested_classes.py | 40 | 4 | assert_* | test_nested_class | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.complexity.nested import (
NESTED_CLASSES_WHITELIST,
NestedClassViolation,
NestedComplexityVisitor,
)
nested_class = """
class Parent:
class {0}: ...
"""
nested_class_in_method = """
class Parent:
def container(self):
... | [NestedClassViolation]) | modified | 4d89b2ca5767401df716267359f638411f3a089d404c9543477be6bcb981d41d | assert_*|test_nested_class|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.complexity.nested import ( NESTED_CLASSES_WHITELIST, NestedClassViolation, NestedComplexityVisitor, ) nested_class = """ class Parent: class {0}: ... """ nested_class_in_method = """ class Parent: def container(self)... | [NestedClassViolation]) | 40 | 4 |
wemake-services/wemake-python-styleguide | train | 17 | 7673dd2896f14dca7be2c7c63147eccd29d59fad | train | tests/test_visitors/test_complexity/test_nested/test_nested_classes.py | test | wemake-services/wemake-python-styleguide:tests/test_visitors/test_complexity/test_nested/test_nested_classes.py | 76 | 4 | assert_* | test_whitelist_nested_classes_in_functions | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.complexity.nested import (
NESTED_CLASSES_WHITELIST,
NestedClassViolation,
NestedComplexityVisitor,
)
nested_class = """
class Parent:
class {0}: ...
"""
nested_class_in_method = """
class Parent:
def container(self):
... | [NestedClassViolation]) | modified | 2367e63fe53afd9659bb687f0d41e5d07f4a8570b2f71d35455f9318afe3e90a | assert_*|test_whitelist_nested_classes_in_functions|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.complexity.nested import ( NESTED_CLASSES_WHITELIST, NestedClassViolation, NestedComplexityVisitor, ) nested_class = """ class Parent: class {0}: ... """ nested_class_in_method = """ class Pa... | [NestedClassViolation]) | 76 | 4 |
wemake-services/wemake-python-styleguide | train | 17 | 7673dd2896f14dca7be2c7c63147eccd29d59fad | train | tests/test_visitors/test_complexity/test_nested/test_nested_functions.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_complexity/test_nested/test_nested_functions.py | 34 | 4 | assert_* | test_nested_function | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.complexity.nested import (
NESTED_FUNCTIONS_WHITELIST,
NestedComplexityVisitor,
NestedFunctionViolation,
)
nested_function = """
def container():
def {0}(): ...
"""
nested_method = """
class Raw:
def container(self):
... | [NestedFunctionViolation]) | modified | 52261ede5f72be53a4d8015728cefb55db7b75a09be46058ec3899789e8da861 | assert_*|test_nested_function|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.complexity.nested import ( NESTED_FUNCTIONS_WHITELIST, NestedComplexityVisitor, NestedFunctionViolation, ) nested_function = """ def container(): def {0}(): ... """ nested_method = """ class Raw: def container(sel... | [NestedFunctionViolation]) | 34 | 4 |
wemake-services/wemake-python-styleguide | train | 17 | 7673dd2896f14dca7be2c7c63147eccd29d59fad | train | tests/test_visitors/test_complexity/test_nested/test_nested_functions.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_complexity/test_nested/test_nested_functions.py | 81 | 4 | assert_* | test_lambda_nested_lambdas | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.complexity.nested import (
NESTED_FUNCTIONS_WHITELIST,
NestedComplexityVisitor,
NestedFunctionViolation,
)
nested_function = """
def container():
def {0}(): ...
"""
nested_method = """
class Raw:
def container(self):
... | [NestedFunctionViolation]) | added | a8f74a8804b8f1018b704daabaace3ebdf55988ad071dd704dc44fd2c91ff4d1 | assert_*|test_lambda_nested_lambdas|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.complexity.nested import ( NESTED_FUNCTIONS_WHITELIST, NestedComplexityVisitor, NestedFunctionViolation, ) nested_function = """ def container(): def {0}(): ... """ nested_method = """ class Raw: def contain... | null | null | null |
wemake-services/wemake-python-styleguide | train | 18 | cf457d488b7c6745713d94ee89052d801a42c05d | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 40 | 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.compat import maybe_set_parent
from wemake_python_styleguide.options import defaults
from wemake_python_styleguide.visitors.base.visitor import Bas... | len(errors) | added | a106787d4d44217296068abd2d4ee44fe287086585a011ea1887a46320f3ef2e | assert||# -*- coding: utf-8 -*- import ast from collections import namedtuple from textwrap import dedent from typing import Sequence import pytest from wemake_python_styleguide.compat import maybe_set_parent from wemake_python_styleguide.options import defaults from wemake_python_styleguide.visitors.base.visitor impor... | null | null | null | |
wemake-services/wemake-python-styleguide | train | 18 | cf457d488b7c6745713d94ee89052d801a42c05d | train | tests/test_visitors/test_complexity/test_nested/test_nested_functions.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_complexity/test_nested/test_nested_functions.py | 83 | 4 | assert_* | test_lambda_nested_lambdas | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.complexity.nested import (
NESTED_FUNCTIONS_WHITELIST,
NestedComplexityVisitor,
NestedFunctionViolation,
)
nested_function = """
def container():
def {0}(): ...
"""
nested_method = """
class Raw:
def container(self):
... | [NestedFunctionViolation]) | modified | eaaf4259cfbc0d0b1dfce55f0ae4750066f352cbc8c0e4f0853d7d2a7f1d4780 | assert_*|test_lambda_nested_lambdas|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.complexity.nested import ( NESTED_FUNCTIONS_WHITELIST, NestedComplexityVisitor, NestedFunctionViolation, ) nested_function = """ def container(): def {0}(): ... """ nested_method = """ class Raw: def contain... | [NestedFunctionViolation]) | 81 | 4 |
wemake-services/wemake-python-styleguide | train | 18 | cf457d488b7c6745713d94ee89052d801a42c05d | train | tests/test_visitors/test_wrong_import/test_dotted_raw_import.py | test | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_import/test_dotted_raw_import.py | 44 | 4 | assert_* | test_wrong_dotted_import | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.wrong_import import (
DottedRawImportViolation,
WrongImportVisitor,
)
regular_import = """
import {0}
"""
regular_import_with_alias = """
import {0} as alias
"""
from_import = """
from {0} import some
"""
from_import_with_alias =... | [DottedRawImportViolation]) | modified | b843db3937d1587e7b84972ce55896f481d2f4e35d01da078e8898e111b389c3 | assert_*|test_wrong_dotted_import|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.wrong_import import ( DottedRawImportViolation, WrongImportVisitor, ) regular_import = """ import {0} """ regular_import_with_alias = """ import {0} as alias """ from_import = """ from {0} import some """ from... | [DottedRawImportViolation]) | 42 | 4 |
wemake-services/wemake-python-styleguide | train | 18 | cf457d488b7c6745713d94ee89052d801a42c05d | train | tests/test_visitors/test_wrong_keyword/test_del.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_keyword/test_del.py | 21 | 4 | assert_* | test_del_keyword | # -*- coding: utf-8 -*-
from wemake_python_styleguide.visitors.wrong_keyword import (
WrongKeywordViolation,
WrongKeywordVisitor,
)
def test_del_keyword(assert_errors, parse_ast_tree, default_options):
"""Testing that `del` keyword is restricted."""
tree = parse_ast_tree("""
def check_del():
... | [ WrongKeywordViolation, WrongKeywordViolation, ]) | modified | db6b0feeec1b043fc7a187fa733fcecb77033454cb063731b449c0aa508f4dd6 | assert_*|test_del_keyword|# -*- coding: utf-8 -*- from wemake_python_styleguide.visitors.wrong_keyword import ( WrongKeywordViolation, WrongKeywordVisitor, ) def test_del_keyword(assert_errors, parse_ast_tree, default_options): """Testing that `del` keyword is restricted.""" tree = parse_ast_tree(""" def check_del(): s... | [ WrongKeywordViolation, WrongKeywordViolation, ]) | 21 | 4 |
wemake-services/wemake-python-styleguide | train | 18 | cf457d488b7c6745713d94ee89052d801a42c05d | train | tests/test_visitors/test_wrong_name/test_class_attributes.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_name/test_class_attributes.py | 74 | 4 | assert_* | test_private_attribute_names | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.visitors.wrong_name import (
BAD_VARIABLE_NAMES,
PrivateNameViolation,
TooShortVariableNameViolation,
WrongNameVisitor,
WrongVariableNameViolation,
)
static_attribute = """
class Test:
{0} = None
"""
instance_... | [PrivateNameViolation]) | modified | d529a867809cb5300b9503b0b1cf558d9368dde48d778358b1aacecad2af6bd5 | assert_*|test_private_attribute_names|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.visitors.wrong_name import ( BAD_VARIABLE_NAMES, PrivateNameViolation, TooShortVariableNameViolation, WrongNameVisitor, WrongVariableNameViolation, ) static_attribute = """ class Test: {0} = None """ ... | [PrivateNameViolation]) | 74 | 4 |
wemake-services/wemake-python-styleguide | train | 18 | cf457d488b7c6745713d94ee89052d801a42c05d | train | tests/test_visitors/test_wrong_name/test_function_names.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_name/test_function_names.py | 39 | 4 | assert_* | test_wrong_function_names | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.visitors.wrong_name import (
BAD_VARIABLE_NAMES,
PrivateNameViolation,
TooShortVariableNameViolation,
WrongNameVisitor,
WrongVariableNameViolation,
)
function_bad_name = """
def {0}(): ...
"""
method_bad_name = ""... | [WrongVariableNameViolation]) | modified | e14c85c8dc782f4c95078142a20950d26f9097c06a58e9d0814f0e6177ef6356 | assert_*|test_wrong_function_names|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.visitors.wrong_name import ( BAD_VARIABLE_NAMES, PrivateNameViolation, TooShortVariableNameViolation, WrongNameVisitor, WrongVariableNameViolation, ) function_bad_name = """ def {0}(): ... """ method_bad... | [WrongVariableNameViolation]) | 39 | 4 |
wemake-services/wemake-python-styleguide | train | 18 | cf457d488b7c6745713d94ee89052d801a42c05d | train | tests/test_visitors/test_wrong_name/test_import_alias.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_name/test_import_alias.py | 38 | 4 | assert_* | test_wrong_import_alias_names | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.visitors.wrong_name import (
BAD_VARIABLE_NAMES,
PrivateNameViolation,
TooShortVariableNameViolation,
WrongNameVisitor,
WrongVariableNameViolation,
)
import_alias = """
import os as {0}
"""
from_import_alias = """... | [WrongVariableNameViolation]) | modified | 3659f13ff9d70a9873a55691b9145b7dc1b274d809104286e2c3375de2032632 | assert_*|test_wrong_import_alias_names|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.visitors.wrong_name import ( BAD_VARIABLE_NAMES, PrivateNameViolation, TooShortVariableNameViolation, WrongNameVisitor, WrongVariableNameViolation, ) import_alias = """ import os as {0} """ from_impo... | [WrongVariableNameViolation]) | 38 | 4 |
wemake-services/wemake-python-styleguide | train | 18 | cf457d488b7c6745713d94ee89052d801a42c05d | train | tests/test_visitors/test_wrong_name/test_variable_names.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_name/test_variable_names.py | 82 | 4 | assert_* | test_too_short_variable_names | # -*- coding: utf-8 -*-
import string
import pytest
from wemake_python_styleguide.visitors.wrong_name import (
BAD_VARIABLE_NAMES,
PrivateNameViolation,
TooShortVariableNameViolation,
WrongNameVisitor,
WrongVariableNameViolation,
)
variable_test = """
{0} = 'test'
"""
underscore_variable_test1 ... | [TooShortVariableNameViolation]) | modified | 2a8505270569fdecdd966baebcc27db1634c9b80b6c7cdab7f6b7e4da3f3f955 | assert_*|test_too_short_variable_names|# -*- coding: utf-8 -*- import string import pytest from wemake_python_styleguide.visitors.wrong_name import ( BAD_VARIABLE_NAMES, PrivateNameViolation, TooShortVariableNameViolation, WrongNameVisitor, WrongVariableNameViolation, ) variable_test = """ {0} = 'test' """ underscore_v... | [TooShortVariableNameViolation]) | 82 | 4 |
wemake-services/wemake-python-styleguide | train | 19 | e6d43a52101b260e079e420b492f1f8b39cdd3f4 | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 38 | 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.compat import maybe_set_parent
from wemake_python_styleguide.options import defaults
from wemake_python_styleguide.visitors.base.visitor import Bas... | index | modified | 77d54f1e7500bfa5860b90d438fe2c1bf9f83c0e3df2247a225f759fd9f49fc2 | assert||# -*- coding: utf-8 -*- import ast from collections import namedtuple from textwrap import dedent from typing import Sequence import pytest from wemake_python_styleguide.compat import maybe_set_parent from wemake_python_styleguide.options import defaults from wemake_python_styleguide.visitors.base.visitor impor... | index | 37 | 12 | |
wemake-services/wemake-python-styleguide | train | 19 | e6d43a52101b260e079e420b492f1f8b39cdd3f4 | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 39 | 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.compat import maybe_set_parent
from wemake_python_styleguide.options import defaults
from wemake_python_styleguide.visitors.base.visitor import Bas... | errors[index]._code | modified | 29b102db40c2b43a2ca90b6180b7e29c17961c7d3519fefade952b19bd562c5d | assert||# -*- coding: utf-8 -*- import ast from collections import namedtuple from textwrap import dedent from typing import Sequence import pytest from wemake_python_styleguide.compat import maybe_set_parent from wemake_python_styleguide.options import defaults from wemake_python_styleguide.visitors.base.visitor impor... | errors[index]._code | 38 | 12 | |
wemake-services/wemake-python-styleguide | train | 19 | e6d43a52101b260e079e420b492f1f8b39cdd3f4 | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 41 | 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.compat import maybe_set_parent
from wemake_python_styleguide.options import defaults
from wemake_python_styleguide.visitors.base.visitor import Bas... | len(errors) | modified | b641c3b814962106d04d2a335b75a8ddf7639635c82ba56672cb9ed3a89e3208 | assert||# -*- coding: utf-8 -*- import ast from collections import namedtuple from textwrap import dedent from typing import Sequence import pytest from wemake_python_styleguide.compat import maybe_set_parent from wemake_python_styleguide.options import defaults from wemake_python_styleguide.visitors.base.visitor impor... | len(errors) | 40 | 8 | |
wemake-services/wemake-python-styleguide | train | 19 | e6d43a52101b260e079e420b492f1f8b39cdd3f4 | train | tests/test_visitors/test_complexity/test_offset/test_offset_visitor.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_complexity/test_offset/test_offset_visitor.py | 79 | 4 | assert_* | test_nested_offset_errors | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.complexity.offset import (
OffsetVisitor,
TooDeepNestingViolation,
)
nested_if = """
def container():
if True:
x = 1
"""
nested_for = """
def container():
for i in '123':
return 0
"""
nested_try = """
def c... | errors) | added | 8e60ffb75bde2a4fb2d0bc80b7673c3dd925b518c7be394552df4b4dcfca525d | assert_*|test_nested_offset_errors|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.complexity.offset import ( OffsetVisitor, TooDeepNestingViolation, ) nested_if = """ def container(): if True: x = 1 """ nested_for = """ def container(): for i in '123': return 0 """ nested_try = """ def con... | null | null | null |
wemake-services/wemake-python-styleguide | train | 20 | 656aa73a68609302586308e83cbdf80d27700176 | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 29 | 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.compat import maybe_set_parent
from wemake_python_styleguide.options import defaults
from wemake_python_styleguide.visitors.base.visitor import Bas... | index | added | 63c1f9196a948cc037de9f30e72c6bb4f8559623be80924a0fe51a30d02cfcad | assert||# -*- coding: utf-8 -*- import ast from collections import namedtuple from textwrap import dedent from typing import Sequence import pytest from wemake_python_styleguide.compat import maybe_set_parent from wemake_python_styleguide.options import defaults from wemake_python_styleguide.visitors.base.visitor impor... | null | null | null | |
wemake-services/wemake-python-styleguide | train | 20 | 656aa73a68609302586308e83cbdf80d27700176 | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 30 | 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.compat import maybe_set_parent
from wemake_python_styleguide.options import defaults
from wemake_python_styleguide.visitors.base.visitor import Bas... | errors[index]._code | added | 4da5d5ec24d08ba345429f5c6d77ba4ddead54c706a271354f50970fdc97c38d | assert||# -*- coding: utf-8 -*- import ast from collections import namedtuple from textwrap import dedent from typing import Sequence import pytest from wemake_python_styleguide.compat import maybe_set_parent from wemake_python_styleguide.options import defaults from wemake_python_styleguide.visitors.base.visitor impor... | null | null | null | |
wemake-services/wemake-python-styleguide | train | 20 | 656aa73a68609302586308e83cbdf80d27700176 | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 32 | 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.compat import maybe_set_parent
from wemake_python_styleguide.options import defaults
from wemake_python_styleguide.visitors.base.visitor import Bas... | len(errors) | added | d3678ee558ae49a580df38f179f415348552a271fa210e470c5938d206313fa3 | assert||# -*- coding: utf-8 -*- import ast from collections import namedtuple from textwrap import dedent from typing import Sequence import pytest from wemake_python_styleguide.compat import maybe_set_parent from wemake_python_styleguide.options import defaults from wemake_python_styleguide.visitors.base.visitor impor... | null | null | null | |
wemake-services/wemake-python-styleguide | train | 20 | 656aa73a68609302586308e83cbdf80d27700176 | train | tests/test_visitors/test_complexity/test_counts/test_method_counts.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_complexity/test_counts/test_method_counts.py | 64 | 4 | assert_* | test_method_counts_violation | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.complexity.counts import (
MethodMembersVisitor,
TooManyMethodsViolation,
)
module_without_methods = """
def first(): ...
def second(): ...
"""
class_with_methods = """
class First(object):
def method(self): ...
def metho... | [TooManyMethodsViolation]) | added | 00250ca29b58e82c0ada82cd2e7ce371d4a8a584ab4bfe851ff9ae8ee5d856cc | assert_*|test_method_counts_violation|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.complexity.counts import ( MethodMembersVisitor, TooManyMethodsViolation, ) module_without_methods = """ def first(): ... def second(): ... """ class_with_methods = """ class First(object): def method(self... | null | null | null |
wemake-services/wemake-python-styleguide | train | 20 | 656aa73a68609302586308e83cbdf80d27700176 | train | tests/test_visitors/test_complexity/test_counts/test_module_counts.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/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.complexity.counts import (
ModuleMembersVisitor,
TooManyModuleMembersViolation,
)
module_with_function_and_class = """
def first(): ...
class Second(object): ...
"""
module_with_methods = """
class First(object):
def method(se... | [TooManyModuleMembersViolation]) | added | b75381ddebe1ee17e84a1d2d3be9acfeed703ebd2ba2ef3711b5033f7ed9caeb | assert_*|test_module_counts_violation|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.complexity.counts import ( ModuleMembersVisitor, TooManyModuleMembersViolation, ) module_with_function_and_class = """ def first(): ... class Second(object): ... """ module_with_methods = """ class First(o... | null | null | null |
wemake-services/wemake-python-styleguide | train | 20 | 656aa73a68609302586308e83cbdf80d27700176 | train | tests/test_visitors/test_complexity/test_function/test_elifs.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_complexity/test_function/test_elifs.py | 62 | 4 | assert_* | test_elif_incorrect_count | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.complexity.function import (
FunctionComplexityVisitor,
TooManyElifsViolation,
)
function_with_elifs = """
def test_module():
if 1 > 2:
print(1)
elif 2 > 3:
print(2)
elif 3 > 4:
print(3)
else:... | [TooManyElifsViolation]) | added | f89f4d54fed71c96c430ab87e3d1f7c97ada66b7b90040efc856b653796f02d7 | assert_*|test_elif_incorrect_count|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.complexity.function import ( FunctionComplexityVisitor, TooManyElifsViolation, ) function_with_elifs = """ def test_module(): if 1 > 2: print(1) elif 2 > 3: print(2) elif 3 > 4: print(3) else: print(4) """ fu... | null | null | null |
wemake-services/wemake-python-styleguide | train | 20 | 656aa73a68609302586308e83cbdf80d27700176 | train | tests/test_visitors/test_complexity/test_offset_visitor.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_complexity/test_offset_visitor.py | 98 | 4 | assert_* | test_nested_offset_errors | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.complexity.offset import (
OffsetVisitor,
TooDeepNestingViolation,
)
nested_if = """
def container():
if True:
x = 1
"""
nested_if2 = """
def container():
if some_value:
call_other()
"""
nested_for = """
de... | errors) | added | ce3d6c232b0a7107817df394eaa7f0edf03806f60e9ce41dc7c018da9cdf43c1 | assert_*|test_nested_offset_errors|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.complexity.offset import ( OffsetVisitor, TooDeepNestingViolation, ) nested_if = """ def container(): if True: x = 1 """ nested_if2 = """ def container(): if some_value: call_other() """ nested_for = """ def ... | null | null | null |
wemake-services/wemake-python-styleguide | train | 20 | 656aa73a68609302586308e83cbdf80d27700176 | train | tests/test_visitors/test_wrong_string.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_wrong_string.py | 53 | 4 | assert_* | test_wrong_string | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.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=2)"... | [FormattedStringViolation]) | added | 4649335ebef8cf68a78f275f7ada4b87bcd8cebbb63e95cbbffab5e6325adbdc | assert_*|test_wrong_string|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.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}... | null | null | null |
wemake-services/wemake-python-styleguide | train | 21 | 5b23c655e25d3bbef47955053af8d88b34e24666 | train | tests/test_visitors/test_complexity/test_function/test_expressions.py | test | wemake-services/wemake-python-styleguide:tests/test_visitors/test_complexity/test_function/test_expressions.py | 48 | 4 | assert_* | test_expressions_wrong_count | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.complexity.function import (
FunctionComplexityVisitor,
TooManyExpressionsViolation,
)
function_without_expressions = """
def function(): ...
"""
function_with_expressions = """
def function():
print(12)
print(12 / 1)
"""
... | [TooManyExpressionsViolation]) | added | f772e6513adcdb4e77e2d1423b5474ebc68722a50f59664d49075afe879a8467 | assert_*|test_expressions_wrong_count|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.complexity.function import ( FunctionComplexityVisitor, TooManyExpressionsViolation, ) function_without_expressions = """ def function(): ... """ function_with_expressions = """ def function(): print(12) p... | null | null | null |
wemake-services/wemake-python-styleguide | train | 21 | 5b23c655e25d3bbef47955053af8d88b34e24666 | train | tests/test_visitors/test_complexity/test_function/test_returns.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_complexity/test_function/test_returns.py | 49 | 4 | assert_* | test_returns_wrong_count | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.complexity.function import (
FunctionComplexityVisitor,
TooManyReturnsViolation,
)
function_without_returns = """
def function(): ...
"""
function_with_returns = """
def function():
if 1 > 2:
return 1
return 0
"""
... | [TooManyReturnsViolation]) | added | 63893d42f8ca6c4f71f4b6e7b02754d620ad3c79a11dece8fbead909edbbafb1 | assert_*|test_returns_wrong_count|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.complexity.function import ( FunctionComplexityVisitor, TooManyReturnsViolation, ) function_without_returns = """ def function(): ... """ function_with_returns = """ def function(): if 1 > 2: return 1 return 0... | null | null | null |
wemake-services/wemake-python-styleguide | train | 22 | 93c580cb768617bef08abdb5b614443d9f62ba05 | train | tests/test_visitors/conftest.py | val | wemake-services/wemake-python-styleguide:tests/test_visitors/conftest.py | 29 | 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.compat import maybe_set_parent
from wemake_python_styleguide.options import defaults
from wemake_python_styleguide.visitors.base import BaseNodeVis... | index | modified | 1e3fa6b75c2387e8211369475291c66f19f3cf97895f0f6daec56f556a2effd4 | assert||# -*- coding: utf-8 -*- import ast from collections import namedtuple from textwrap import dedent from typing import Sequence import pytest from wemake_python_styleguide.compat import maybe_set_parent from wemake_python_styleguide.options import defaults from wemake_python_styleguide.visitors.base import BaseNo... | index | 29 | 12 | |
wemake-services/wemake-python-styleguide | train | 22 | 93c580cb768617bef08abdb5b614443d9f62ba05 | 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 | 62 | 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 = """
def test_module():
if 1 > 2:
print(1)
elif 2 > 3:
print(2)
elif 3 > 4:
print(3)
e... | [TooManyElifsViolation]) | modified | 5f06608085b7ac2c06d1dfee6f3ce992082dbca3d4e0530b74d57533b2d12265 | assert_*|test_elif_incorrect_count|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.complexity.function import ( FunctionComplexityVisitor, TooManyElifsViolation, ) function_with_elifs = """ def test_module(): if 1 > 2: print(1) elif 2 > 3: print(2) elif 3 > 4: print(3) else: print(4) ""... | [TooManyElifsViolation]) | 62 | 4 |
wemake-services/wemake-python-styleguide | train | 22 | 93c580cb768617bef08abdb5b614443d9f62ba05 | 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 | 83 | 4 | assert_* | test_lambda_nested_lambdas | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.complexity.nested import (
NESTED_FUNCTIONS_WHITELIST,
NestedComplexityVisitor,
NestedFunctionViolation,
)
nested_function = """
def container():
def {0}(): ...
"""
nested_method = """
class Raw:
def container(self)... | [NestedFunctionViolation]) | modified | 82fd7db91dbb1ed7b0460ca4c02911f39cf0c67071414b53cd0562e8f960cfdf | assert_*|test_lambda_nested_lambdas|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.complexity.nested import ( NESTED_FUNCTIONS_WHITELIST, NestedComplexityVisitor, NestedFunctionViolation, ) nested_function = """ def container(): def {0}(): ... """ nested_method = """ class Raw: def con... | [NestedFunctionViolation]) | 83 | 4 |
wemake-services/wemake-python-styleguide | train | 22 | 93c580cb768617bef08abdb5b614443d9f62ba05 | train | tests/test_visitors/test_ast/test_wrong_import/test_nested_imports.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_wrong_import/test_nested_imports.py | 68 | 4 | assert_* | test_nested_import | # -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.visitors.ast.wrong_import import (
NestedImportViolation,
WrongImportVisitor,
)
# Incorrect imports:
nested_function_import = """
def function():
import os
"""
nested_function_from_import = """
def function():
from os import path
"... | [NestedImportViolation]) | added | 8c18d702756971afc8783c3751df5652d0c60ade398a9d087c30e669aafbb581 | assert_*|test_nested_import|# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.visitors.ast.wrong_import import ( NestedImportViolation, WrongImportVisitor, ) # Incorrect imports: nested_function_import = """ def function(): import os """ nested_function_from_import = """ def function(): from os import... | null | null | null |
wemake-services/wemake-python-styleguide | train | 22 | 93c580cb768617bef08abdb5b614443d9f62ba05 | train | tests/test_visitors/test_ast/test_wrong_keyword/test_del.py | train | wemake-services/wemake-python-styleguide:tests/test_visitors/test_ast/test_wrong_keyword/test_del.py | 21 | 4 | assert_* | test_del_keyword | # -*- coding: utf-8 -*-
from wemake_python_styleguide.visitors.ast.wrong_keyword import (
WrongKeywordViolation,
WrongKeywordVisitor,
)
def test_del_keyword(assert_errors, parse_ast_tree, default_options):
"""Testing that `del` keyword is restricted."""
tree = parse_ast_tree("""
def check_del():
... | [ WrongKeywordViolation, WrongKeywordViolation, ]) | modified | 45ccc013417875d1a3154de7b2e913661aa3834f19fe83c67e694d5c4a24ab42 | assert_*|test_del_keyword|# -*- coding: utf-8 -*- from wemake_python_styleguide.visitors.ast.wrong_keyword import ( WrongKeywordViolation, WrongKeywordVisitor, ) def test_del_keyword(assert_errors, parse_ast_tree, default_options): """Testing that `del` keyword is restricted.""" tree = parse_ast_tree(""" def check_del(... | [ WrongKeywordViolation, WrongKeywordViolation, ]) | 21 | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.