repo_id stringclasses 400
values | commit_sha stringclasses 400
values | commit_index int32 0 951 | in_repo_split stringclasses 1
value | cross_repo_split stringclasses 1
value | test_file stringlengths 7 121 | test_function stringlengths 1 108 | assertion_type stringclasses 32
values | difficulty stringclasses 8
values | context_lines int32 3 600 | prefix large_stringlengths 44 113k | target large_stringlengths 1 498 | anchor_sha stringclasses 400
values | anchor_index int32 0 951 | qna_source stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | _pytest/test_unfurl.py | test_unfurl_refs | assert | complex_expr | 178 | from __future__ import print_function, unicode_literals
from datetime import datetime, timedelta
import pytest
import time
import wee_slack
import os
os.environ["TZ"] = "UTC"
@pytest.mark.parametrize(
"case",
(
{
"input": "foo",
"output": "foo",
},
{
... | case["output"] | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | _pytest/test_unwrap_attachments.py | test_unwrap_attachments | assert | complex_expr | 552 | from __future__ import print_function, unicode_literals
import wee_slack
import pytest
@pytest.mark.parametrize(
"case",
(
{
"input_message": {
"attachments": [
{
"title": "Title",
}
]
... | case["output"] | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | _pytest/test_utf8_helpers.py | test_encode_should_not_transform_str | assert | func_call | 14 | from __future__ import print_function, unicode_literals
import sys
from collections import OrderedDict
from wee_slack import decode_from_utf8, encode_to_utf8, utf8_decode
b_ae = "æ".encode("utf-8")
b_oe = "ø".encode("utf-8")
b_aa = "å".encode("utf-8")
b_word = b_ae + b_oe + b_aa
def test_encode_should_not_transf... | encode_to_utf8("æøå") | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | _pytest/test_utf8_helpers.py | test_encode_should_not_transform_bytes | assert | func_call | 14 | from __future__ import print_function, unicode_literals
import sys
from collections import OrderedDict
from wee_slack import decode_from_utf8, encode_to_utf8, utf8_decode
b_ae = "æ".encode("utf-8")
b_oe = "ø".encode("utf-8")
b_aa = "å".encode("utf-8")
b_word = b_ae + b_oe + b_aa
def test_encode_should_not_transf... | encode_to_utf8(b_word) | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | _pytest/test_utf8_helpers.py | test_encode_preserves_string_without_utf8 | assert | func_call | 14 | from __future__ import print_function, unicode_literals
import sys
from collections import OrderedDict
from wee_slack import decode_from_utf8, encode_to_utf8, utf8_decode
b_ae = "æ".encode("utf-8")
b_oe = "ø".encode("utf-8")
b_aa = "å".encode("utf-8")
b_word = b_ae + b_oe + b_aa
def test_encode_preserves_string_... | encode_to_utf8("test") | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | _pytest/test_utf8_helpers.py | test_utf8_decode | assert | func_call | 19 | from __future__ import print_function, unicode_literals
import sys
from collections import OrderedDict
from wee_slack import decode_from_utf8, encode_to_utf8, utf8_decode
b_ae = "æ".encode("utf-8")
b_oe = "ø".encode("utf-8")
b_aa = "å".encode("utf-8")
b_word = b_ae + b_oe + b_aa
def test_utf8_decode():
a... | decode_from_utf8(args) | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | _pytest/test_utf8_helpers.py | test_decode_should_not_transform_str | assert | func_call | 14 | from __future__ import print_function, unicode_literals
import sys
from collections import OrderedDict
from wee_slack import decode_from_utf8, encode_to_utf8, utf8_decode
b_ae = "æ".encode("utf-8")
b_oe = "ø".encode("utf-8")
b_aa = "å".encode("utf-8")
b_word = b_ae + b_oe + b_aa
def test_decode_should_not_transf... | decode_from_utf8("æøå") | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | _pytest/test_utf8_helpers.py | test_decode_should_not_transform_bytes | assert | func_call | 14 | from __future__ import print_function, unicode_literals
import sys
from collections import OrderedDict
from wee_slack import decode_from_utf8, encode_to_utf8, utf8_decode
b_ae = "æ".encode("utf-8")
b_oe = "ø".encode("utf-8")
b_aa = "å".encode("utf-8")
b_word = b_ae + b_oe + b_aa
def test_decode_should_not_transf... | decode_from_utf8(b_word) | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | _pytest/test_utf8_helpers.py | test_utf8_decode | assert | func_call | 20 | from __future__ import print_function, unicode_literals
import sys
from collections import OrderedDict
from wee_slack import decode_from_utf8, encode_to_utf8, utf8_decode
b_ae = "æ".encode("utf-8")
b_oe = "ø".encode("utf-8")
b_aa = "å".encode("utf-8")
b_word = b_ae + b_oe + b_aa
def test_utf8_decode():
a... | decode_from_utf8(kwargs) | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | _pytest/test_utf8_helpers.py | test_decode_preserves_string_without_utf8 | assert | func_call | 14 | from __future__ import print_function, unicode_literals
import sys
from collections import OrderedDict
from wee_slack import decode_from_utf8, encode_to_utf8, utf8_decode
b_ae = "æ".encode("utf-8")
b_oe = "ø".encode("utf-8")
b_aa = "å".encode("utf-8")
b_word = b_ae + b_oe + b_aa
def test_decode_preserves_string_... | decode_from_utf8(b"test") | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | _pytest/test_utf8_helpers.py | test_encode_preserves_iterable_type | assert | func_call | 16 | from __future__ import print_function, unicode_literals
import sys
from collections import OrderedDict
from wee_slack import decode_from_utf8, encode_to_utf8, utf8_decode
b_ae = "æ".encode("utf-8")
b_oe = "ø".encode("utf-8")
b_aa = "å".encode("utf-8")
b_word = b_ae + b_oe + b_aa
def test_encode_preserves_iterabl... | type(encode_to_utf8(value_set)) | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | _pytest/test_utf8_helpers.py | test_encodes_utf8_list_to_unicode | assert | func_call | 14 | from __future__ import print_function, unicode_literals
import sys
from collections import OrderedDict
from wee_slack import decode_from_utf8, encode_to_utf8, utf8_decode
b_ae = "æ".encode("utf-8")
b_oe = "ø".encode("utf-8")
b_aa = "å".encode("utf-8")
b_word = b_ae + b_oe + b_aa
def test_encodes_utf8_list_to_uni... | encode_to_utf8(["æ", "ø", "å"]) | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | _pytest/test_utf8_helpers.py | test_encode_preserves_mapping_type | assert | func_call | 16 | from __future__ import print_function, unicode_literals
import sys
from collections import OrderedDict
from wee_slack import decode_from_utf8, encode_to_utf8, utf8_decode
b_ae = "æ".encode("utf-8")
b_oe = "ø".encode("utf-8")
b_aa = "å".encode("utf-8")
b_word = b_ae + b_oe + b_aa
def test_encode_preserves_mapping... | type(encode_to_utf8(value_dict)) | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | _pytest/test_utf8_helpers.py | test_decode_preserves_iterable_type | assert | func_call | 16 | from __future__ import print_function, unicode_literals
import sys
from collections import OrderedDict
from wee_slack import decode_from_utf8, encode_to_utf8, utf8_decode
b_ae = "æ".encode("utf-8")
b_oe = "ø".encode("utf-8")
b_aa = "å".encode("utf-8")
b_word = b_ae + b_oe + b_aa
def test_decode_preserves_iterabl... | type(decode_from_utf8(value_set)) | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | _pytest/test_utf8_helpers.py | test_encode_preserves_iterable_type | assert | func_call | 17 | from __future__ import print_function, unicode_literals
import sys
from collections import OrderedDict
from wee_slack import decode_from_utf8, encode_to_utf8, utf8_decode
b_ae = "æ".encode("utf-8")
b_oe = "ø".encode("utf-8")
b_aa = "å".encode("utf-8")
b_word = b_ae + b_oe + b_aa
def test_encode_preserves_iterabl... | type(encode_to_utf8(value_tuple)) | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | _pytest/test_utf8_helpers.py | test_decode_preserves_mapping_type | assert | func_call | 16 | from __future__ import print_function, unicode_literals
import sys
from collections import OrderedDict
from wee_slack import decode_from_utf8, encode_to_utf8, utf8_decode
b_ae = "æ".encode("utf-8")
b_oe = "ø".encode("utf-8")
b_aa = "å".encode("utf-8")
b_word = b_ae + b_oe + b_aa
def test_decode_preserves_mapping... | type(decode_from_utf8(value_dict)) | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | _pytest/test_utf8_helpers.py | test_decode_preserves_iterable_type | assert | func_call | 17 | from __future__ import print_function, unicode_literals
import sys
from collections import OrderedDict
from wee_slack import decode_from_utf8, encode_to_utf8, utf8_decode
b_ae = "æ".encode("utf-8")
b_oe = "ø".encode("utf-8")
b_aa = "å".encode("utf-8")
b_word = b_ae + b_oe + b_aa
def test_decode_preserves_iterabl... | type(decode_from_utf8(value_tuple)) | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | _pytest/test_utf8_helpers.py | test_decodes_utf8_list_to_unicode | assert | func_call | 14 | from __future__ import print_function, unicode_literals
import sys
from collections import OrderedDict
from wee_slack import decode_from_utf8, encode_to_utf8, utf8_decode
b_ae = "æ".encode("utf-8")
b_oe = "ø".encode("utf-8")
b_aa = "å".encode("utf-8")
b_word = b_ae + b_oe + b_aa
def test_decodes_utf8_list_to_uni... | decode_from_utf8([b_ae, b_oe, b_aa]) | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | tests/conftest.py | resolve_pending_message_item | pytest.raises | variable | 94 | from __future__ import annotations
import importlib
import importlib.machinery
import json
import sys
from typing import TYPE_CHECKING, Union
import pytest
def import_stub(stubs_path: str, module_name: str):
sys.path_hooks.insert(
0,
importlib.machinery.FileFinder.path_hook(
(importli... | StopIteration) | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | tests/test_commands.py | test_parse_options_without_options | assert | collection | 10 | from itertools import accumulate
import slack.commands
from slack.commands import parse_options
def test_parse_options_without_options():
pos_args, options = parse_options("workspace add wee-slack-test")
assert pos_args == "workspace add wee-slack-test"
assert options == | {} | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | tests/test_commands.py | test_parse_options_with_option | assert | collection | 10 | from itertools import accumulate
import slack.commands
from slack.commands import parse_options
def test_parse_options_with_option():
pos_args, options = parse_options("workspace add wee-slack-test -autoconnect")
assert pos_args == "workspace add wee-slack-test"
assert options == | {"autoconnect": None} | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | tests/test_commands.py | test_all_parent_commands_exist | assert | complex_expr | 11 | from itertools import accumulate
import slack.commands
from slack.commands import parse_options
def test_all_parent_commands_exist():
for command in slack.commands.commands:
parents = accumulate(command.split(" "), lambda x, y: f"{x} {y}")
for parent in parents:
assert parent in | slack.commands.commands | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | tests/test_commands.py | test_parse_options_without_options | assert | string_literal | 9 | from itertools import accumulate
import slack.commands
from slack.commands import parse_options
def test_parse_options_without_options():
pos_args, options = parse_options("workspace add wee-slack-test")
assert pos_args == | "workspace add wee-slack-test" | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | tests/test_commands.py | test_parse_options_option_with_value | assert | collection | 12 | from itertools import accumulate
import slack.commands
from slack.commands import parse_options
def test_parse_options_option_with_value():
pos_args, options = parse_options(
"workspace add wee-slack-test -autoconnect -api_token=xoxp-1"
)
assert pos_args == "workspace add wee-slack-test"
asse... | {"autoconnect": None, "api_token": "xoxp-1"} | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | tests/test_hook_process_hashtable.py | test_hook_process_hashtable | assert_* | complex_expr | 22 | from unittest.mock import MagicMock, patch
import pytest
import weechat
import slack.http
from slack.http import hook_process_hashtable
from slack.task import FutureProcess, FutureTimer, weechat_task_cb
from slack.util import get_callback_name
@patch.object(weechat, "hook_process_hashtable")
def test_hook_process_ha... | future.id) | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | tests/test_hook_process_hashtable.py | test_hook_process_hashtable_chunked | assert_* | complex_expr | 22 | from unittest.mock import MagicMock, patch
import pytest
import weechat
import slack.http
from slack.http import hook_process_hashtable
from slack.task import FutureProcess, FutureTimer, weechat_task_cb
from slack.util import get_callback_name
@patch.object(weechat, "hook_process_hashtable")
def test_hook_process_ha... | future_1.id) | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | tests/test_hook_process_hashtable.py | test_hook_process_hashtable | pytest.raises | variable | 26 | from unittest.mock import MagicMock, patch
import pytest
import weechat
import slack.http
from slack.http import hook_process_hashtable
from slack.task import FutureProcess, FutureTimer, weechat_task_cb
from slack.util import get_callback_name
@patch.object(weechat, "hook_process_hashtable")
def test_hook_process_ha... | StopIteration) | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | tests/test_hook_process_hashtable.py | test_hook_process_hashtable | assert | collection | 28 | from unittest.mock import MagicMock, patch
import pytest
import weechat
import slack.http
from slack.http import hook_process_hashtable
from slack.task import FutureProcess, FutureTimer, weechat_task_cb
from slack.util import get_callback_name
@patch.object(weechat, "hook_process_hashtable")
def test_hook_process_ha... | (command, 0, "out", "err") | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | tests/test_hook_process_hashtable.py | test_hook_process_hashtable_chunked | assert | collection | 36 | from unittest.mock import MagicMock, patch
import pytest
import weechat
import slack.http
from slack.http import hook_process_hashtable
from slack.task import FutureProcess, FutureTimer, weechat_task_cb
from slack.util import get_callback_name
@patch.object(weechat, "hook_process_hashtable")
def test_hook_process_ha... | (command, 0, "o1o2o3", "e1e2e3") | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | tests/test_http_request.py | test_http_request_process_error_stderr | assert | numeric_literal | 24 | 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
def test_ht... | 0 | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | tests/test_http_request.py | test_http_request_process_error_return_code | assert | numeric_literal | 24 | 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
def test_ht... | -2 | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | tests/test_http_request.py | test_http_request_process_error_return_code | assert | string_literal | 26 | 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
def test_ht... | "" | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | tests/test_http_request.py | test_http_request_url_error | assert | variable | 23 | 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
def test_ht... | url | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | tests/test_http_request.py | test_http_request_error_http_status | assert | numeric_literal | 28 | 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
def test_ht... | 400 | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | tests/test_http_request.py | test_http_request_url_error | assert | none_literal | 24 | 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
def test_ht... | None | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | tests/test_http_request.py | test_http_request_process_error_stderr | assert | string_literal | 26 | 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
def test_ht... | "err" | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | tests/test_http_request.py | test_http_request_url_error | assert | string_literal | 26 | 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
def test_ht... | "error" | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | tests/test_http_request.py | test_http_request_success | assert | string_literal | 36 | 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.obje... | "response" | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | tests/test_slackts.py | test_slackts_eq | assert | variable | 15 | 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_base | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | tests/test_slackts.py | test_slackts_eq | assert | variable | 17 | 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... | str_base | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | tests/test_slackts.py | test_slackts_eq | assert | variable | 16 | 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_base_not_padded | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | tests/test_slackts.py | test_slackts_ne | assert | variable | 15 | 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 | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | tests/test_slackts.py | test_slackts_ne | assert | variable | 16 | 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_major | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | tests/test_sleep.py | test_sleep | assert | collection | 24 | 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)
futur... | (0,) | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | tests/test_sleep.py | test_sleep | assert_* | complex_expr | 18 | 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)
futur... | future.id) | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | tests/test_sleep.py | test_sleep | pytest.raises | variable | 22 | 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)
futur... | StopIteration) | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | tests/test_task_runner.py | test_run_single_task | assert | collection | 21 | from collections import defaultdict
from slack.shared import shared
from slack.task import Future, create_task, weechat_task_cb
def test_run_single_task():
shared.active_tasks = defaultdict(list)
shared.active_futures = {}
future = Future[str]()
async def awaitable():
result = await future
... | ("awaitable", ("data",)) | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | tests/test_task_runner.py | test_run_two_tasks_concurrently | assert | collection | 24 | from collections import defaultdict
from slack.shared import shared
from slack.task import Future, create_task, weechat_task_cb
def test_run_two_tasks_concurrently():
shared.active_tasks = defaultdict(list)
shared.active_futures = {}
future1 = Future[str]()
future2 = Future[str]()
async def await... | ("awaitable", ("data1",)) | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | tests/test_task_runner.py | test_run_two_tasks_concurrently | assert | collection | 25 | from collections import defaultdict
from slack.shared import shared
from slack.task import Future, create_task, weechat_task_cb
def test_run_two_tasks_concurrently():
shared.active_tasks = defaultdict(list)
shared.active_futures = {}
future1 = Future[str]()
future2 = Future[str]()
async def await... | ("awaitable", ("data2",)) | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | tests/test_task_runner.py | test_run_nested_task | assert | collection | 25 | from collections import defaultdict
from slack.shared import shared
from slack.task import Future, create_task, weechat_task_cb
def test_run_nested_task():
shared.active_tasks = defaultdict(list)
shared.active_futures = {}
future = Future[str]()
async def awaitable1():
result = await future
... | ("awaitable2", ("awaitable1", ("data",))) | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wee-slack/wee-slack | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | train | train | tests/test_unfurl.py | test_unfurl_refs | assert | complex_expr | 27 | 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"] | 19fe2300fd85e0b96e53e2cdf14f28f947585f12 | 94 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_offset_visitor.py | test_real_nesting_config | assert_* | complex_expr | 86 | import pytest
from wemake_python_styleguide.visitors.ast.complexity.offset import (
OffsetVisitor,
TooDeepNestingViolation,
)
nested_if = """
def container():
if True:
x = 1
"""
nested_if2 = """
def container():
if some_value:
call_other()
"""
nested_for = """
def container():
fo... | 10 * 2) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_checker/test_module_names.py | test_module_names | assert | complex_expr | 29 | import ast
import pytest
from wemake_python_styleguide.checker import Checker
from wemake_python_styleguide.violations import naming
@pytest.mark.parametrize(('filename', 'error'), [
('__magic__.py', naming.WrongModuleMagicNameViolation),
('util.py', naming.WrongModuleNameViolation),
('x.py', naming.TooS... | error.code | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_options/test_option_rules.py | test_option_help | assert | complex_expr | 8 | from wemake_python_styleguide.options import config
def test_option_help():
"""Ensures that all options has help."""
for option in config.Configuration._options: # noqa: WPS437
assert len(option.help) > 10
assert '%default' in | option.help | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_violations/test_codes.py | test_violations_start_zero | assert | complex_expr | 11 | from collections import Counter
def test_violations_start_zero(all_module_violations):
"""Ensures that all violations start at zero."""
for index, module in enumerate(all_module_violations.keys()):
starting_code = min(
violation_class.code
for violation_class in all_module_viola... | index * 100 | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_checker/test_exception_handling.py | test_exception_handling | assert | complex_expr | 23 | import ast
from contextlib import suppress
from wemake_python_styleguide.checker import Checker
from wemake_python_styleguide.violations.system import InternalErrorViolation
from wemake_python_styleguide.visitors.base import BaseNodeVisitor
def test_exception_handling(
default_options,
capsys,
):
"""Ensur... | captured.out | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_checker/test_hypothesis.py | test_no_exceptions | assert | complex_expr | 53 | import io
import tokenize
import hypothesmith
from hypothesis import HealthCheck, given, reject, settings
from wemake_python_styleguide.checker import Checker
settings.register_profile(
'slow', deadline=None, suppress_health_check=HealthCheck.all(),
)
settings.load_profile('slow')
def _fixup(string: str) -> str... | violation[2] | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_options/test_option_rules.py | test_option_docs | assert | complex_expr | 8 | from wemake_python_styleguide.options import config
def test_option_docs():
"""Ensures that all options are documented."""
for option in config.Configuration._options: # noqa: WPS437
option_name = '``{0}``'.format(option.long_option_name[2:])
assert option_name in | config.__doc__ | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_violations/test_docs.py | test_all_violations_have_versionadded | assert | complex_expr | 11 | from wemake_python_styleguide.options.config import Configuration
FORMATTING_OPTIONS = frozenset((
'--show-violation-links',
))
def test_all_violations_have_versionadded(all_violations):
"""Ensures that all violations have `versionadded` tag."""
for violation in all_violations:
assert '.. version... | violation.__doc__ | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/conftest.py | factory | assert | complex_expr | 39 | from typing import Optional, Sequence, Tuple, Type, Union
import pytest
from typing_extensions import Final, TypeAlias
from wemake_python_styleguide.violations.base import (
ASTViolation,
BaseViolation,
TokenizeViolation,
)
from wemake_python_styleguide.visitors.base import BaseVisitor
_IgnoredTypes: Typ... | errors[index].code | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_violations/test_codes.py | test_all_violations_correct_numbers | assert | complex_expr | 11 | from collections import Counter
def test_all_violations_correct_numbers(all_module_violations):
"""Ensures that all violations has correct violation code numbers."""
assert len(all_module_violations) == 7
for index, module in enumerate(all_module_violations.keys()):
code_number = index * 100
... | violation_class.code | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_function/test_awaits_count.py | test_awaits_wrong_count | assert_* | complex_expr | 47 | import pytest
from wemake_python_styleguide.violations.complexity import (
TooManyAwaitsViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.function import (
FunctionComplexityVisitor,
)
function_without_awaits = 'def function(): ...'
function_async_without_awaits = 'async def function(): ...'
... | option_values.max_awaits) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_function/test_raises.py | test_raises_wrong_count | assert_* | complex_expr | 84 | import pytest
from wemake_python_styleguide.violations.complexity import (
TooManyRaisesViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.function import (
FunctionComplexityVisitor,
)
module_many_raises = """
if some:
raise SomeException
raise SomeOtherException
"""
lambda_many_raises =... | option_values.max_raises) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_classes/test_method_counts.py | test_method_counts_violation | assert_* | complex_expr | 127 | import pytest
from wemake_python_styleguide.visitors.ast.complexity.classes import (
MethodMembersVisitor,
TooManyMethodsViolation,
)
module_without_methods = """
def first(): ...
def second(): ...
"""
module_with_async_functions = """
async def first(): ...
async def second(): ...
"""
module_async_and_us... | option_values.max_methods) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_builtins/test_strings/test_alphabet_string.py | test_alphabet_as_string_violation | assert_* | variable | 46 | import string
import pytest
from wemake_python_styleguide.violations.best_practices import (
StringConstantRedefinedViolation,
)
from wemake_python_styleguide.violations.consistency import (
FormattedStringViolation,
)
from wemake_python_styleguide.visitors.ast.builtins import WrongStringVisitor
@pytest.mark... | code) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_checker/test_invalid_options.py | test_invalid_options | assert | variable | 24 | import subprocess
def test_invalid_options(absolute_path):
"""End-to-End test to check option validation works."""
process = subprocess.Popen(
[
'flake8',
'--isolated',
'--select',
'WPS',
'--max-imports',
'-5', # should be positiv... | stderr | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_checker/test_noqa.py | _assert_errors_count_in_output | assert | variable | 329 | import re
import subprocess
import sys
import types
from collections import Counter
import pytest
_PY_OLD = sys.version_info < (3, 8)
_PY38 = (3, 8) <= sys.version_info < (3, 9)
_PY39 = (3, 9) <= sys.version_info < (3, 10)
_PY310 = (3, 10) <= sys.version_info < (3, 11)
ERROR_PATTERN = re.compile(r'(WPS\d{3})')
IGNO... | errors | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_transformations/test_enhancements.py | test_evaluate_valid_operations | assert | variable | 24 | import pytest
@pytest.mark.parametrize(('expression', 'output'), [
('-1 + 1', 0),
('1 * 2', 2),
('"a" * 5', 'aaaaa'),
('b"hello" * 2', b'hellohello'),
('"hello " + "world"', 'hello world'),
('(2 + 6) / 4 - 2', 0),
('1 << 4', 16),
('255 >> 4', 15),
('2**4', 16),
('5^9', 12),
... | output | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_checker/test_hypothesis.py | test_no_exceptions | assert | variable | 54 | import io
import tokenize
import hypothesmith
from hypothesis import HealthCheck, given, reject, settings
from wemake_python_styleguide.checker import Checker
settings.register_profile(
'slow', deadline=None, suppress_health_check=HealthCheck.all(),
)
settings.load_profile('slow')
def _fixup(string: str) -> str... | Checker | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_classes/test_methods/test_async_magic_methods.py | test_wrong_async_magic_used | assert_* | variable | 38 | import pytest
from wemake_python_styleguide.violations.oop import AsyncMagicMethodViolation
from wemake_python_styleguide.visitors.ast.classes import WrongMethodVisitor
sync_method = """
class Example(object):
def {0}(self): ...
"""
async_method = """
class Example(object):
async def {0}(self): ...
"""
@pyt... | method) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_classes/test_methods/test_async_yield_magic_methods.py | test_wrong_async_magic_used | assert_* | variable | 40 | import pytest
from wemake_python_styleguide.violations.oop import AsyncMagicMethodViolation
from wemake_python_styleguide.visitors.ast.classes import WrongMethodVisitor
sync_method = """
class Example(object):
def {0}(self, *args, **kwargs):
{1}
"""
async_method = """
class Example(object):
async def... | method) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_classes/test_methods/test_magic_methods.py | test_wrong_magic_used | assert_* | variable | 30 | import pytest
from wemake_python_styleguide.constants import MAGIC_METHODS_BLACKLIST
from wemake_python_styleguide.violations.oop import BadMagicMethodViolation
from wemake_python_styleguide.visitors.ast.classes import WrongMethodVisitor
magic_method = """
class Example(object):
def {0}(self): ...
"""
regular_fu... | method) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_classes/test_methods/test_yield_magic_method.py | test_magic_generator | assert_* | variable | 54 | import pytest
from wemake_python_styleguide.violations.oop import YieldMagicMethodViolation
from wemake_python_styleguide.visitors.ast.classes import WrongMethodVisitor
method_template = """
class Test(object):
def {0}(self, *args, **kwargs):
{1}
"""
classmethod_template = """
class Test(object):
@cl... | method) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_offset_visitor.py | test_nested_offset_errors | assert_* | variable | 98 | import pytest
from wemake_python_styleguide.visitors.ast.complexity.offset import (
OffsetVisitor,
TooDeepNestingViolation,
)
nested_if = """
def container():
if True:
x = 1
"""
nested_if2 = """
def container():
if some_value:
call_other()
"""
nested_for = """
def container():
fo... | errors) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_naming/test_module_metadata.py | test_wrong_metadata | assert_* | variable | 50 | import pytest
from wemake_python_styleguide.violations.best_practices import (
WrongModuleMetadataViolation,
)
from wemake_python_styleguide.visitors.ast.naming.variables import (
MODULE_METADATA_VARIABLES_BLACKLIST,
WrongModuleMetadataVisitor,
)
module_metadata = """
{0} = 'Nikita'
"""
module_type_metad... | bad_name) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_naming/test_naming_rules/test_reserved_argument.py | test_reserved_argument_name | assert_* | variable | 49 | from contextlib import suppress
import pytest
from wemake_python_styleguide.constants import SPECIAL_ARGUMENT_NAMES_WHITELIST
from wemake_python_styleguide.violations.naming import (
ReservedArgumentNameViolation,
)
from wemake_python_styleguide.visitors.ast.naming.validation import (
WrongNameVisitor,
)
cor... | argument) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_tokenize/test_primitives/test_string_tokens/test_string_modifier.py | test_uppercase_prefix | assert_* | variable | 45 | import pytest
from wemake_python_styleguide.violations.consistency import (
RawStringNotNeededViolation,
UppercaseStringModifierViolation,
)
from wemake_python_styleguide.visitors.tokenize.primitives import (
WrongStringTokenVisitor,
)
@pytest.mark.parametrize('modifier', [
'R',
'B',
'F',
])
@... | modifier) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_logic/test_complexity/test_annotations_complexity.py | test_get_annotation_complexity | assert | variable | 35 | import pytest
from wemake_python_styleguide.logic.complexity import annotations
@pytest.mark.parametrize(('annotation', 'complexity'), [
# simple annotations
('str', 1),
('int', 1),
('List', 1),
('List[str]', 2),
('List[int]', 2),
('Dict[str, int]', 2),
# empty values
('Literal[""... | complexity | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_logic/test_complexity/test_cognitive/test_cognitive_complexity.py | test_cognitive_complexity | assert | variable | 170 | import pytest
complexity1_1 = """
def f(a, b):
if a: # +1
return 1
"""
complexity1_2 = """
def f(a):
return a * f(a - 1) # +1 for recursion
"""
complexity1_3 = """
class Test(object):
def f(self, a):
return a * self.f(a - 1) # +1 for recursion
"""
complexity2_1 = """
def f(a, b):
... | complexity | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_attributes/test_magic_attributes.py | test_disallowed_magic_attribute_is_restricted | assert_* | variable | 143 | import pytest
from wemake_python_styleguide.violations.oop import (
DirectMagicAttributeAccessViolation,
)
from wemake_python_styleguide.visitors.ast.attributes import (
WrongAttributeVisitor,
)
magic_attribute_assigned = 'some.{0} = 1'
magic_attribute_accessed = 'print(some.{0})'
magic_method_called = 'some.... | attribute) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_checker/test_invalid_options.py | test_invalid_options | assert | numeric_literal | 23 | import subprocess
def test_invalid_options(absolute_path):
"""End-to-End test to check option validation works."""
process = subprocess.Popen(
[
'flake8',
'--isolated',
'--select',
'WPS',
'--max-imports',
'-5', # should be positiv... | 1 | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_checker/test_noqa.py | test_noqa_fixture | assert | numeric_literal | 355 | import re
import subprocess
import sys
import types
from collections import Counter
import pytest
_PY_OLD = sys.version_info < (3, 8)
_PY38 = (3, 8) <= sys.version_info < (3, 9)
_PY39 = (3, 9) <= sys.version_info < (3, 10)
_PY310 = (3, 10) <= sys.version_info < (3, 11)
ERROR_PATTERN = re.compile(r'(WPS\d{3})')
IGNO... | 0 | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_plugins.py | _assert_plugin_output | assert | numeric_literal | 24 | import subprocess
PLUGINS = (
'B002', # flake8-bugbear
'C400', # flake8-comprehensions
'C819', # flake8-commas
'D103', # flake8-docstring
'E225', # pycodestyle
'E800', # flake8-eradicate
'F401', # pyflakes
'N400', # flake8-broken-line
'N802', # pep8-naming
'P101', # fl... | 0 | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_checker/test_noqa.py | _assert_errors_count_in_output | assert | func_call | 332 | import re
import subprocess
import sys
import types
from collections import Counter
import pytest
_PY_OLD = sys.version_info < (3, 8)
_PY38 = (3, 8) <= sys.version_info < (3, 9)
_PY39 = (3, 9) <= sys.version_info < (3, 10)
_PY310 = (3, 10) <= sys.version_info < (3, 11)
ERROR_PATTERN = re.compile(r'(WPS\d{3})')
IGNO... | set() | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/conftest.py | factory | assert | func_call | 36 | from typing import Optional, Sequence, Tuple, Type, Union
import pytest
from typing_extensions import Final, TypeAlias
from wemake_python_styleguide.violations.base import (
ASTViolation,
BaseViolation,
TokenizeViolation,
)
from wemake_python_styleguide.visitors.base import BaseVisitor
_IgnoredTypes: Typ... | len(real_errors) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_checker/test_noqa.py | test_codes | assert | func_call | 338 | import re
import subprocess
import sys
import types
from collections import Counter
import pytest
_PY_OLD = sys.version_info < (3, 8)
_PY38 = (3, 8) <= sys.version_info < (3, 9)
_PY39 = (3, 9) <= sys.version_info < (3, 10)
_PY310 = (3, 10) <= sys.version_info < (3, 11)
ERROR_PATTERN = re.compile(r'(WPS\d{3})')
IGNO... | len(all_violations) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_violations/test_codes.py | test_all_unique_violation_codes | assert | func_call | 7 | from collections import Counter
def test_all_unique_violation_codes(all_violations):
"""Ensures that all violations have unique violation codes."""
codes = [int(violation.code) for violation in all_violations]
assert len(set(codes)) == | len(all_violations) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_options/test_option_rules.py | test_option_asdict_no_none | assert | func_call | 13 | from wemake_python_styleguide.options import config
def test_option_asdict_no_none():
"""Ensure that `None` is not returned from `asdict_no_none()`."""
opt = config._Option( # noqa: WPS437
'--foo',
default=False,
action='store_true',
type=None,
help='',
)
asser... | opt.asdict_no_none() | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_counts/test_condition_counts.py | test_module_condition_real_config | assert_* | string_literal | 82 | import pytest
from wemake_python_styleguide.violations.complexity import (
TooManyConditionsViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.counts import (
ConditionsVisitor,
)
empty_module = ''
assignment = 'some = x > y or None'
condition_with_single_if = """
if 4 > 2 and 3 / 2 == 1.5:
... | '5') | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_counts/test_elifs.py | test_elif_incorrect_count | assert_* | string_literal | 183 | import pytest
from wemake_python_styleguide.violations.complexity import TooManyElifsViolation
from wemake_python_styleguide.visitors.ast.complexity.counts import ElifVisitor
module_with_one_elif = """
if 1 > 2:
...
elif 2 > 3:
...
else:
...
"""
module_with_two_elifs = """
if 1 > 2:
...
elif 2 > 3:
... | '4') | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_counts/test_try_body_length.py | test_try_body_wrong_custom_options | assert_* | string_literal | 95 | import pytest
from wemake_python_styleguide.violations.complexity import (
TooLongTryBodyViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.counts import (
TryExceptVisitor,
)
try_without_except = """
try:
{0}
finally:
...
"""
simple_try_except = """
try:
{0}
except ValueError:
... | '2') | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_complexity/test_counts/test_try_except.py | test_try_except_count_default | assert_* | string_literal | 71 | import pytest
from wemake_python_styleguide.violations.complexity import (
TooManyExceptCasesViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.counts import (
TryExceptVisitor,
)
try_without_except = """
try:
...
finally:
...
"""
simple_try_except = """
try:
...
except ValueError... | '4') | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_tokenize/test_primitives/test_numbers/test_complex_suffix.py | test_bad_complex_suffix | assert_* | string_literal | 34 | import pytest
from wemake_python_styleguide.violations.consistency import (
BadComplexNumberSuffixViolation,
)
from wemake_python_styleguide.visitors.tokenize.primitives import (
WrongNumberTokenVisitor,
)
@pytest.mark.parametrize('number', [
'1J',
'2J + 10',
])
def test_bad_complex_suffix(
parse_... | 'J') | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_keywords/test_del.py | test_del_keyword | assert_* | string_literal | 48 | import pytest
from wemake_python_styleguide.violations.best_practices import (
WrongKeywordViolation,
)
from wemake_python_styleguide.visitors.ast.keywords import WrongKeywordVisitor
del_variable = """
x = 5
del x
"""
del_key = """
temp_dict = {'a': 1}
del temp_dict['a']
"""
del_index = """
temp_list = [1, 2, 3... | 'del') | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_options/test_option_values/test_i_control_code.py | test_parsing_i_control_code | assert | bool_literal | 9 | def test_parsing_i_control_code(option_parser):
"""Ensures that ``i_control_code`` can be parsed."""
namespace = option_parser.parse_args(['--i-control-code'])
try:
args, _ = namespace # flake8 < 5
except TypeError:
args = namespace
assert args.i_control_code is | True | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_regressions/test_regression112.py | test_regression112 | assert | none_literal | 51 | import ast
from pyflakes.checker import Checker as PyFlakesChecker
from wemake_python_styleguide.checker import Checker
code_that_breaks = '''
def current_session(
telegram_id: int,
for_update: bool = True,
) -> TelegramSession:
"""
Was triggering `AttributeError`.
See: https://github.com/wemake... | None | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_annotations/test_multiline_annotations/test_argument_annotations.py | test_correct_argument_annotation | assert_* | collection | 69 | import pytest
from wemake_python_styleguide.visitors.ast.annotations import (
MultilineFunctionAnnotationViolation,
WrongAnnotationVisitor,
)
correct_function_without_arguments = """
def function(): ...
"""
correct_function_without_annotations = """
def function(arg, arg1, arg2): ...
"""
correct_simple_argu... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_annotations/test_multiline_annotations/test_return_annotations.py | test_correct_return_annotation | assert_* | collection | 75 | import pytest
from wemake_python_styleguide.visitors.ast.annotations import (
MultilineFunctionAnnotationViolation,
WrongAnnotationVisitor,
)
correct_function_without_annotations = """
def function(): ...
"""
correct_simple_return = """
def function() -> int: ...
"""
correct_compound_return = """
def functi... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_attributes/test_magic_attributes.py | test_magic_attribute_correct_contexts | assert_* | collection | 145 | import pytest
from wemake_python_styleguide.violations.oop import (
DirectMagicAttributeAccessViolation,
)
from wemake_python_styleguide.visitors.ast.attributes import (
WrongAttributeVisitor,
)
magic_attribute_assigned = 'some.{0} = 1'
magic_attribute_accessed = 'print(some.{0})'
magic_method_called = 'some.... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
wemake-services/wemake-python-styleguide | f119ba9b7f460478cc16279551594d80c2988769 | 566 | train | train | tests/test_visitors/test_ast/test_attributes/test_protected_attributes.py | test_protected_attribute_is_allowed | assert_* | collection | 134 | import pytest
from wemake_python_styleguide.visitors.ast.attributes import (
ProtectedAttributeViolation,
WrongAttributeVisitor,
)
protected_attribute_assigned = 'some._protected = 1'
protected_attribute_accessed = 'print(some._protected)'
protected_method_called = 'some._protected()'
protected_method_called_... | []) | f119ba9b7f460478cc16279551594d80c2988769 | 566 | v2_extractor_at_anchor |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.