repo_id stringclasses 409
values | prefix large_stringlengths 34 36.3k | target large_stringlengths 1 498 | assertion_type stringclasses 31
values | difficulty stringclasses 8
values | test_file stringlengths 10 121 | test_function stringlengths 1 104 | test_class stringlengths 0 51 | lineno int32 2 11.3k | commit_idx int32 |
|---|---|---|---|---|---|---|---|---|---|
gadievron/raptor | import sys
from pathlib import Path
import pytest
sys.path.insert(0, str(Path(__file__).parent.parent))
from src.collectors.api import GitHubAPICollector
from src.collectors.archive import GHArchiveCollector
from src.collectors.local import LocalGitCollector
from src.schema.common import EvidenceSource, IOCType
pyt... | 7710 | assert | numeric_literal | .claude/skills/oss-forensics/github-evidence-kit/tests/test_integration.py | test_fetch_revert_pr_7710 | TestAmazonQTimelineIntegration | 191 | null |
gadievron/raptor | import sys
from pathlib import Path
import pytest
sys.path.insert(0, str(Path(__file__).parent.parent))
from src.clients.gharchive import GHArchiveClient
from src.clients.git import GitClient
from src.clients.github import GitHubClient
from src.clients.wayback import WaybackClient
from src.schema.common import Evide... | "project2" | assert | string_literal | .claude/skills/oss-forensics/github-evidence-kit/tests/test_clients.py | test_multiple_gharchive_clients_independent | TestClientIsolation | 166 | null |
gadievron/raptor | import pytest
import sys
import os
import logging
from io import StringIO
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent.parent.parent))
from packages.llm_analysis.llm.client import LLMClient
from packages.llm_analysis.llm.config import ModelConfig, LLMConfig
class TestOllamaWarning:
... | "WARNING" | assert | string_literal | packages/llm_analysis/tests/test_ollama_warning.py | test_warning_format | TestOllamaWarning | 149 | null |
gadievron/raptor | import os
import subprocess
import tempfile
import pytest
from pathlib import Path
from unittest.mock import patch, MagicMock
def find_any_elf_binary():
"""Find any ELF binary on the system for testing."""
# Try common system binaries that should exist
candidates = [
"/bin/ls",
"/bin/cat",
... | {} | assert | collection | packages/exploit_feasibility/tests/test_integration.py | test_payload_constraints_instantiates | TestDataclassDefaultsValid | 244 | null |
gadievron/raptor | import sys
from pathlib import Path
import pytest
sys.path.insert(0, str(Path(__file__).parent.parent))
from src.clients.gharchive import GHArchiveClient
from src.clients.git import GitClient
from src.clients.github import GitHubClient
from src.clients.wayback import WaybackClient
from src.schema.common import Evide... | "." | assert | string_literal | .claude/skills/oss-forensics/github-evidence-kit/tests/test_clients.py | test_default_repo_path | TestGitClient | 134 | null |
gadievron/raptor | from unittest.mock import Mock, patch
import pytest
from src.collectors.local import LocalGitCollector
from src.schema.common import EvidenceSource
def mock_git_client():
client = Mock()
client.get_commit.return_value = {
"sha": "a" * 40,
"author_name": "Test Author",
"author_email": ... | "a" * 40 | assert | string_literal | .claude/skills/oss-forensics/github-evidence-kit/tests/test_collectors_local.py | test_collect_commit | 36 | null | |
gadievron/raptor | import pytest
from unittest.mock import patch, MagicMock
from ..api import (
find_exploit_paths,
format_analysis_summary,
check_exploit_viability,
get_exploit_constraints,
list_primitives,
get_primitive_requirements,
)
class TestCheckExploitViability:
def test_returns_tuple(self):
... | 2 | assert | numeric_literal | packages/exploit_feasibility/tests/test_api_functions.py | test_returns_tuple | TestCheckExploitViability | 149 | null |
gadievron/raptor | import sys
from pathlib import Path
import pytest
sys.path.insert(0, str(Path(__file__).parent.parent))
from src.collectors.api import GitHubAPICollector
from src.collectors.archive import GHArchiveCollector
from src.collectors.local import LocalGitCollector
from src.schema.common import EvidenceSource, IOCType
pyt... | 1 | assert | numeric_literal | .claude/skills/oss-forensics/github-evidence-kit/tests/test_integration.py | test_fetch_real_pull_request | TestGitHubAPIIntegration | 105 | null |
gadievron/raptor | import pytest
import time
import sys
import os
import litellm
from io import StringIO
from unittest.mock import patch, MagicMock
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent.parent.parent))
from packages.llm_analysis.llm.client import LLMClient
from packages.llm_analysis.llm.config imp... | Exception) | pytest.raises | variable | packages/llm_analysis/tests/test_llm_callbacks.py | test_failure_event_sanitizes_api_keys | TestCallbackFailureEvent | 100 | null |
gadievron/raptor | import sys
from pathlib import Path
import pytest
sys.path.insert(0, str(Path(__file__).parent.parent))
from src.parsers import (
_RowContext,
parse_create_event,
parse_delete_event,
parse_fork_event,
parse_gharchive_event,
parse_issue_event,
parse_member_event,
parse_public_event,
... | "push" | assert | string_literal | .claude/skills/oss-forensics/github-evidence-kit/tests/test_parsers.py | test_parses_basic_push | TestParsePushEvent | 96 | null |
gadievron/raptor | import pytest
from ..graph import (
PrimitiveDependencyGraph,
create_dependency_graph,
)
class TestPrimitiveDependencyGraph:
def test_get_primitive_info(self):
"""Test getting primitive info."""
graph = PrimitiveDependencyGraph()
info = graph.get_primitive_info("libc_leak")
... | None | assert | none_literal | packages/exploit_feasibility/tests/test_graph.py | test_get_primitive_info | TestPrimitiveDependencyGraph | 95 | null |
gadievron/raptor | import pytest
from ..context import (
ROPGadgetInfo,
ELFStructure,
AddressSpaceInfo,
PayloadConstraints,
ExploitPrimitive,
WriteTarget,
)
class TestROPGadgetInfoExtended:
def test_charset_filtering_fields(self):
"""Test charset filtering count fields."""
info = ROPGadgetInf... | 15 | assert | numeric_literal | packages/exploit_feasibility/tests/test_extended_dataclasses.py | test_charset_filtering_fields | TestROPGadgetInfoExtended | 52 | null |
gadievron/raptor | import sys
from pathlib import Path
import pytest
sys.path.insert(0, str(Path(__file__).parent.parent))
from src.collectors.api import GitHubAPICollector
from src.collectors.archive import GHArchiveCollector
from src.collectors.local import LocalGitCollector
from src.schema.common import EvidenceSource, IOCType
pyt... | 0 | assert | numeric_literal | .claude/skills/oss-forensics/github-evidence-kit/tests/test_integration.py | test_fetch_amazon_q_push_event | TestGHArchiveIntegration | 263 | null |
gadievron/raptor | import pytest
from unittest.mock import patch, MagicMock
from packages.exploit_feasibility.profiles import (
TargetContext,
TargetProfile,
create_local_profile,
create_remote_profile,
create_web_profile,
create_kernel_profile,
)
from packages.exploit_feasibility.strategies import (
Analysis... | True | assert | bool_literal | packages/exploit_feasibility/tests/test_strategies.py | test_can_detect_locally | TestLocalBinaryStrategy | 77 | null |
gadievron/raptor | import os
import json
import tempfile
import pytest
from pathlib import Path
from packages.exploitability_validation import (
build_checklist,
extract_functions,
detect_language,
update_checklist_coverage,
get_coverage_stats,
validate_checklist,
validate_findings,
create_empty_checklist... | 3 | assert | numeric_literal | packages/exploitability_validation/tests/test_validation.py | test_python_functions | TestFunctionExtraction | 75 | null |
gadievron/raptor | import sys
from pathlib import Path
import pytest
sys.path.insert(0, str(Path(__file__).parent.parent))
from src.clients.gharchive import GHArchiveClient
from src.clients.git import GitClient
from src.clients.github import GitHubClient
from src.clients.wayback import WaybackClient
from src.schema.common import Evide... | None | assert | none_literal | .claude/skills/oss-forensics/github-evidence-kit/tests/test_clients.py | test_lazy_session_creation | TestGitHubClient | 43 | null |
gadievron/raptor | import pytest
from ..techniques import (
TechniqueRequirements,
get_technique_requirements,
get_technique,
get_techniques_for_goal,
get_viable_techniques,
get_missing_primitives,
)
class TestGetMissingPrimitives:
def test_missing_one(self):
"""Test when one primitive is missing."""... | missing | assert | variable | packages/exploit_feasibility/tests/test_techniques.py | test_missing_one | TestGetMissingPrimitives | 166 | null |
gadievron/raptor | import json
import os
import tempfile
import pytest
from pathlib import Path
from unittest.mock import patch, MagicMock
from ..api import (
save_exploit_context,
load_exploit_context,
print_exploit_context,
)
class TestSaveExploitContext:
def mock_analysis_result(self):
"""Mock result from an... | subdir | assert | variable | packages/exploit_feasibility/tests/test_api_persistence.py | test_save_uses_binary_parent_dir_by_default | TestSaveExploitContext | 142 | null |
gadievron/raptor | import pytest
from ..context import (
ExploitationConstraints,
PayloadConstraints,
LibcInfo,
ROPGadgetInfo,
ELFStructure,
AddressSpaceInfo,
)
class TestExploitationConstraints:
def test_x86_64_defaults(self):
"""Test x86_64 architecture defaults."""
constraints = Exploitati... | 8 | assert | numeric_literal | packages/exploit_feasibility/tests/test_context.py | test_x86_64_defaults | TestExploitationConstraints | 21 | null |
gadievron/raptor | import pytest
from ..context import (
ExploitationConstraints,
PayloadConstraints,
LibcInfo,
ROPGadgetInfo,
ELFStructure,
AddressSpaceInfo,
)
class TestExploitationConstraints:
def test_x86_64_strcpy_blocks_rop(self):
"""Test that x86_64 with strcpy blocks ROP."""
constrain... | 0 | assert | numeric_literal | packages/exploit_feasibility/tests/test_context.py | test_x86_64_strcpy_blocks_rop | TestExploitationConstraints | 29 | null |
gadievron/raptor | import pytest
from ..graph import (
PrimitiveDependencyGraph,
create_dependency_graph,
)
class TestPrimitiveDependencyGraph:
def test_get_shortest_path(self):
"""Test getting shortest path."""
graph = PrimitiveDependencyGraph()
path = graph.get_shortest_path("format_string_vuln")
... | 10 | assert | numeric_literal | packages/exploit_feasibility/tests/test_graph.py | test_get_shortest_path | TestPrimitiveDependencyGraph | 81 | null |
gadievron/raptor | import pytest
from ..context import (
ExploitationConstraints,
PayloadConstraints,
LibcInfo,
ROPGadgetInfo,
ELFStructure,
AddressSpaceInfo,
)
class TestExploitationConstraints:
def test_i386_defaults(self):
"""Test i386 architecture defaults."""
constraints = ExploitationCo... | 4 | assert | numeric_literal | packages/exploit_feasibility/tests/test_context.py | test_i386_defaults | TestExploitationConstraints | 35 | null |
gadievron/raptor | import pytest
from ..constraints import (
analyze_input_constraints,
analyze_bad_byte_impact,
assess_libc_fingerprinting,
InputConstraintAnalysis,
BadByteImpact,
LibcFingerprintingPotential,
)
class TestInputConstraintAnalysis:
def test_strcpy_x86_64_blocks_rop(self):
"""Test that ... | 6 | assert | numeric_literal | packages/exploit_feasibility/tests/test_constraints.py | test_strcpy_x86_64_blocks_rop | TestInputConstraintAnalysis | 24 | null |
gadievron/raptor | import os
import json
import tempfile
import pytest
from pathlib import Path
from packages.exploitability_validation import (
build_checklist,
extract_functions,
detect_language,
update_checklist_coverage,
get_coverage_stats,
validate_checklist,
validate_findings,
create_empty_checklist... | 2 | assert | numeric_literal | packages/exploitability_validation/tests/test_validation.py | test_build_from_directory | TestChecklistBuilder | 208 | null |
gadievron/raptor | from unittest.mock import Mock, patch
import pytest
from src.collectors.local import LocalGitCollector
from src.schema.common import EvidenceSource
def mock_git_client():
client = Mock()
client.get_commit.return_value = {
"sha": "a" * 40,
"author_name": "Test Author",
"author_email": ... | "test.py" | assert | string_literal | .claude/skills/oss-forensics/github-evidence-kit/tests/test_collectors_local.py | test_collect_commit | 42 | null | |
gadievron/raptor | import pytest
from ..primitives import (
Primitive,
PrimitiveID,
PrimitiveType,
MitigationID,
ConfidenceScore,
ExploitPath,
get_primitive_definitions,
)
class TestExploitPath:
def test_compute_confidence(self):
"""Test confidence computation."""
path = ExploitPath(
... | 90 | assert | numeric_literal | packages/exploit_feasibility/tests/test_primitives.py | test_compute_confidence | TestExploitPath | 189 | null |
gadievron/raptor | import pytest
from ..constraints import (
analyze_input_constraints,
analyze_bad_byte_impact,
assess_libc_fingerprinting,
InputConstraintAnalysis,
BadByteImpact,
LibcFingerprintingPotential,
)
class TestLibcFingerprinting:
def test_good_fingerprinting_many_symbols(self):
"""Test go... | 5 | assert | numeric_literal | packages/exploit_feasibility/tests/test_constraints.py | test_good_fingerprinting_many_symbols | TestLibcFingerprinting | 239 | null |
gadievron/raptor | import sys
from pathlib import Path
import pytest
sys.path.insert(0, str(Path(__file__).parent.parent))
from src.collectors.api import GitHubAPICollector
from src.collectors.archive import GHArchiveCollector
from src.collectors.local import LocalGitCollector
from src.schema.common import EvidenceSource, IOCType
pyt... | True | assert | bool_literal | .claude/skills/oss-forensics/github-evidence-kit/tests/test_integration.py | test_fetch_real_pull_request | TestGitHubAPIIntegration | 106 | null |
gadievron/raptor | import os
import subprocess
import tempfile
import pytest
from pathlib import Path
from unittest.mock import patch, MagicMock
def find_any_elf_binary():
"""Find any ELF binary on the system for testing."""
# Try common system binaries that should exist
candidates = [
"/bin/ls",
"/bin/cat",
... | elf | assert | variable | packages/exploit_feasibility/tests/test_integration.py | test_elf_structure_serialized_correctly | TestAnalyzeBinaryIntegration | 136 | null |
gadievron/raptor | import pytest
from ..constraints import (
analyze_input_constraints,
analyze_bad_byte_impact,
assess_libc_fingerprinting,
InputConstraintAnalysis,
BadByteImpact,
LibcFingerprintingPotential,
)
class TestLibcFingerprinting:
def test_poor_fingerprinting_minimal_symbols(self):
"""Test... | 1 | assert | numeric_literal | packages/exploit_feasibility/tests/test_constraints.py | test_poor_fingerprinting_minimal_symbols | TestLibcFingerprinting | 257 | null |
wee-slack/wee-slack | from __future__ import annotations
from typing import TYPE_CHECKING, Any, List, Literal
import pytest
from slack.shared import shared
from slack.slack_message import SlackMessage
from tests.conftest import (
channel_public_id,
color_default,
color_user_mention,
resolve_pending_message_item,
user_... | case["output"] | assert | complex_expr | tests/test_render_attachments.py | test_render_attachments | 751 | null | |
wee-slack/wee-slack | from __future__ import annotations
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 i... | "err" | assert | string_literal | tests/test_http_request.py | test_http_request_process_error_stderr | 115 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import re
from wee_slack import linkify_text
def test_linkifytext_not_mpdm(team, channel_mpdm):
text = linkify_text("#{}: my test message".format(channel_mpdm.name), team)
assert text == | "#{}: my test message".format(channel_mpdm.name) | assert | string_literal | _pytest/test_linkifytext.py | test_linkifytext_not_mpdm | 110 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import json
def test_process_subteam_self_updated(realish_eventrouter, team):
assert len(team.subteams) == 1
datafile = "_pytest/data/websocket/1483975206.59-subteam_updated.json"
data = json.loads(open(datafile, "r").read())
team.ws.add(data)
... | subteam.handle | assert | complex_expr | _pytest/test_processsubteamupdated.py | test_process_subteam_self_updated | 16 | null | |
wee-slack/wee-slack | from __future__ import annotations
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_diffe... | ts_base | assert | variable | tests/test_slackts.py | test_slackts_eq | 17 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import re
from wee_slack import linkify_text
def test_linkifytext_names_with_paranthesis(team):
text = linkify_text("@JohnDoe(jdoe): my test message", team)
assert text == | "@JohnDoe(jdoe): my test message" | assert | string_literal | _pytest/test_linkifytext.py | test_linkifytext_names_with_paranthesis | 19 | null | |
wee-slack/wee-slack | from __future__ import annotations
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 i... | 400 | assert | numeric_literal | tests/test_http_request.py | test_http_request_error_http_status | 134 | null | |
wee-slack/wee-slack | from __future__ import annotations
import importlib
import importlib.machinery
import json
import sys
from typing import TYPE_CHECKING, Dict, Union
import pytest
def import_stub(stubs_path: str, module_name: str):
sys.path_hooks.insert(
0,
importlib.machinery.FileFinder.path_hook(
(im... | StopIteration) | pytest.raises | variable | tests/conftest.py | resolve_pending_message_item | 223 | null | |
wee-slack/wee-slack | from __future__ import annotations
from typing import TYPE_CHECKING, List
import pytest
from slack.shared import shared
from slack.slack_message import SlackMessage
from tests.conftest import (
color_default,
color_user_mention,
resolve_pending_message_item,
user_test1_id,
)
@pytest.mark.parametrize... | case["rendered"] | assert | complex_expr | tests/test_render_blocks.py | test_render_blocks | 499 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
from textwrap import dedent
from wee_slack import SlackRequest
def test_http_check_ratelimited_supports_multiple_headers(realish_eventrouter):
response = (
dedent(
"""
HTTP/1.1 200 Connection established
HTTP/2 20... | "" | assert | string_literal | _pytest/test_http_check_ratelimited.py | test_http_check_ratelimited_supports_multiple_headers | 28 | null | |
wee-slack/wee-slack | from __future__ import annotations
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 i... | -2 | assert | numeric_literal | tests/test_http_request.py | test_http_request_process_error_return_code | 96 | null | |
wee-slack/wee-slack | 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)) | assert | func_call | _pytest/test_utf8_helpers.py | test_decode_preserves_iterable_type | 47 | null | |
wee-slack/wee-slack | from __future__ import annotations
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 ... | ("awaitable", ("data2",)) | assert | collection | tests/test_task_runner.py | test_run_two_tasks_concurrently | 65 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
from wee_slack import SlackTS
def test_slackts():
base = SlackTS("1485976156.000017")
b = SlackTS("1485976156.000016")
c = SlackTS("1485976156.000018")
d = SlackTS("1485976155.000017")
e = SlackTS("1485976157.000017")
assert base > b
... | d | assert | variable | _pytest/test_slackts.py | test_slackts | 18 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
from wee_slack import SlackTS
def test_slackts():
base = SlackTS("1485976156.000017")
b = SlackTS("1485976156.000016")
c = SlackTS("1485976156.000018")
d = SlackTS("1485976155.000017")
e = SlackTS("1485976157.000017")
assert base > | b | assert | variable | _pytest/test_slackts.py | test_slackts | 15 | null | |
wee-slack/wee-slack | 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)) | assert | func_call | _pytest/test_utf8_helpers.py | test_decode_preserves_mapping_type | 41 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import wee_slack
from wee_slack import parse_topic_command, topic_command_cb
from mock import patch
def test_parse_topic_with_channel():
channel_name, topic = parse_topic_command("/topic #general")
assert channel_name == | "#general" | assert | string_literal | _pytest/test_topic_command.py | test_parse_topic_with_channel | 39 | null | |
wee-slack/wee-slack | from __future__ import annotations
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 i... | "" | assert | string_literal | tests/test_http_request.py | test_http_request_process_error_return_code | 98 | null | |
wee-slack/wee-slack | from __future__ import annotations
from itertools import accumulate
from slack.commands import parse_options
from slack.shared import shared
def test_parse_options_option_with_value_only_first():
pos_args, options = parse_options(
"arg1 -option1 -option2=value2", options_only_first=True
)
assert... | "arg1 -option1 -option2=value2" | assert | string_literal | tests/test_commands.py | test_parse_options_option_with_value_only_first | 78 | null | |
wee-slack/wee-slack | from __future__ import annotations
from typing import TYPE_CHECKING, List
import pytest
from slack.shared import shared
from slack.slack_message import SlackMessage
from tests.conftest import (
color_default,
user_test1_id,
user_test2_id,
)
@pytest.mark.parametrize("case", cases)
def test_create_reactio... | StopIteration) | pytest.raises | variable | tests/test_render_reactions.py | test_create_reactions_string | 71 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import json
from wee_slack import SlackTS
thread_ts = SlackTS("1485975824.000004")
def test_message_has_thread_suffix(realish_eventrouter, team, channel_general):
datafile = "_pytest/data/websocket/1485975824.48-message.json"
data = json.loads(open(dat... | "generally, yep! <[color lightcyan]>[ Thread: 309 Replies: 2 ]<[color reset]>" | assert | string_literal | _pytest/test_thread.py | test_message_has_thread_suffix | 40 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import json
from wee_slack import SlackTS
def test_process_message(realish_eventrouter, team, user_alice):
messages = []
messages.append(
json.loads(
open("_pytest/data/websocket/1485975421.33-message.json", "r").read()
)
... | 3 | assert | numeric_literal | _pytest/test_process_message.py | test_process_message | 49 | null | |
wee-slack/wee-slack | from __future__ import annotations
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
corou... | StopIteration) | pytest.raises | variable | tests/test_sleep.py | test_sleep | 24 | null | |
wee-slack/wee-slack | from __future__ import annotations
from slack.util import get_cookies
def test_get_cookies_multiple_keys_value_encoded():
cookie = get_cookies("d=a%2Bb ; d-s=1")
assert cookie == | "d=a%2Bb; d-s=1" | assert | string_literal | tests/test_get_cookies.py | test_get_cookies_multiple_keys_value_encoded | 18 | null | |
wee-slack/wee-slack | from __future__ import annotations
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_diffe... | str_base | assert | variable | tests/test_slackts.py | test_slackts_eq | 19 | null | |
wee-slack/wee-slack | from __future__ import annotations
from itertools import accumulate
from slack.commands import parse_options
from slack.shared import shared
def test_parse_options_with_option_last_only_first():
pos_args, options = parse_options("arg1 -option1", options_only_first=True)
assert pos_args == | "arg1 -option1" | assert | string_literal | tests/test_commands.py | test_parse_options_with_option_last_only_first | 64 | null | |
wee-slack/wee-slack | import pytest
import wee_slack
@pytest.mark.parametrize(
"case",
[
{
"input_message": {
"blocks": [
{
"type": "rich_text",
"block_id": "5Cg6",
"elements": [
... | case["rendered"] | assert | complex_expr | _pytest/test_render_message.py | test_render_message | 174 | null | |
wee-slack/wee-slack | from __future__ import annotations
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 i... | 0 | assert | numeric_literal | tests/test_http_request.py | test_http_request_process_error_stderr | 113 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import json
from wee_slack import SlackTS
thread_ts = SlackTS("1485975824.000004")
def test_message_has_thread_suffix(realish_eventrouter, team, channel_general):
datafile = "_pytest/data/websocket/1485975824.48-message.json"
data = json.loads(open(dat... | "generally, yep! <[color lightcyan]>[ Thread: 309 Replies: 1 ]<[color reset]>" | assert | string_literal | _pytest/test_thread.py | test_message_has_thread_suffix | 28 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import wee_slack
import pytest
@pytest.mark.parametrize(
"case",
(
{
"input_message": {
"attachments": [
{
"title": "Title",
}
]
... | case["output"] | assert | complex_expr | _pytest/test_unwrap_attachments.py | test_unwrap_attachments | 552 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import json
def test_process_team_join(realish_eventrouter, team):
# delete charles so we can add him
del team.users["U4096CBHC"]
assert len(team.users) == 3
datafile = "_pytest/data/websocket/1485975606.59-team_join.json"
data = json.loads... | 4 | assert | numeric_literal | _pytest/test_processteamjoin.py | test_process_team_join | 18 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import re
from wee_slack import linkify_text
def test_linkifytext_channel(team, channel_general):
channel_name = re.sub(r"^[#&]", "", channel_general.name)
text = linkify_text("#{}: my test message".format(channel_name), team)
assert text == | "<#{}|{}>: my test message".format(channel_general.id, channel_name) | assert | string_literal | _pytest/test_linkifytext.py | test_linkifytext_channel | 84 | null | |
wee-slack/wee-slack | from __future__ import annotations
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 i... | "error" | assert | string_literal | tests/test_http_request.py | test_http_request_url_error | 81 | null | |
wee-slack/wee-slack | 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_default,
color_user_mention,
color_usergroup_mention,
resolve_pending_message_item,... | case["output"] | assert | complex_expr | tests/test_unfurl.py | test_unfurl_refs | 59 | null | |
wee-slack/wee-slack | from __future__ import annotations
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_diffe... | ts_different_minor | assert | variable | tests/test_slackts.py | test_slackts_ne | 27 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import re
from wee_slack import linkify_text
def test_linkifytext_not_private_using_ampersand(team, channel_private):
channel_name = re.sub(r"^[#&]", "", channel_private.name)
text = linkify_text("&{}: my test message".format(channel_name), team)
... | "&{}: my test message".format(channel_name) | assert | string_literal | _pytest/test_linkifytext.py | test_linkifytext_not_private_using_ampersand | 98 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import wee_slack
from wee_slack import parse_topic_command, topic_command_cb
from mock import patch
def test_call_topic_with_channel_and_string(realish_eventrouter, channel_general):
current_buffer = channel_general.channel_buffer
wee_slack.EVENTROUTER =... | wee_slack.w.WEECHAT_RC_OK_EAT | assert | complex_expr | _pytest/test_topic_command.py | test_call_topic_with_channel_and_string | 102 | null | |
wee-slack/wee-slack | 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)) | assert | func_call | _pytest/test_utf8_helpers.py | test_decode_preserves_iterable_type | 48 | null | |
wee-slack/wee-slack | from __future__ import annotations
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 i... | url | assert | variable | tests/test_http_request.py | test_http_request_url_error | 78 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
from textwrap import dedent
from wee_slack import SlackRequest
def test_http_check_ratelimited_return_error_when_ratelimited(realish_eventrouter):
response = (
dedent(
"""
HTTP/2 429
content-type: application/json;... | "ratelimited" | assert | string_literal | _pytest/test_http_check_ratelimited.py | test_http_check_ratelimited_return_error_when_ratelimited | 49 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import re
from wee_slack import linkify_text
def test_linkifytext_names_with_subgroup_notification(team):
subteam = team.subteams["TGX0ALBK3"]
message = "This is a message for a subteam"
text = linkify_text("{}: {}".format(subteam.handle, message), ... | "<!subteam^{}|{}>: {}".format( subteam.identifier, subteam.handle, message ) | assert | string_literal | _pytest/test_linkifytext.py | test_linkifytext_names_with_subgroup_notification | 51 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import re
from wee_slack import linkify_text
def test_linkifytext_not_dm(team, channel_dm):
text = linkify_text("#{}: my test message".format(channel_dm.name), team)
assert text == | "#{}: my test message".format(channel_dm.name) | assert | string_literal | _pytest/test_linkifytext.py | test_linkifytext_not_dm | 104 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import re
from wee_slack import linkify_text
def test_linkifytext_does_partial_html_entity_encoding(team):
text = linkify_text("& < > ' \"", team)
assert text == | "& < > ' \"" | assert | string_literal | _pytest/test_linkifytext.py | test_linkifytext_does_partial_html_entity_encoding | 13 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import wee_slack
from wee_slack import parse_topic_command, topic_command_cb
from mock import patch
def test_parse_topic_without_arguments():
channel_name, topic = parse_topic_command("/topic")
assert channel_name is | None | assert | none_literal | _pytest/test_topic_command.py | test_parse_topic_without_arguments | 11 | null | |
wee-slack/wee-slack | from __future__ import annotations
from itertools import accumulate
from slack.commands import parse_options
from slack.shared import shared
def test_parse_options_without_options():
pos_args, options = parse_options("arg1 arg2", options_only_first=False)
assert pos_args == "arg1 arg2"
assert options ==... | {} | assert | collection | tests/test_commands.py | test_parse_options_without_options | 21 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import pytest
import wee_slack
@pytest.mark.parametrize(
"case",
(
{
"type": "channel",
"style": "default",
"typing": False,
"present": False,
"name": "#general",
},
{
... | case["name"] | assert | complex_expr | _pytest/test_formatted_name.py | test_formatted_name | 208 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import json
def test_send_message(realish_eventrouter, team, channel_general):
message_text = "send message test"
channel_general.send_message(message_text)
sent = json.loads(team.ws.sentdata[0])
assert sent == | { "text": message_text, "type": "message", "user": team.myidentifier, "channel": channel_general.id, "id": 1, } | assert | collection | _pytest/test_sendmessage.py | test_send_message | 12 | null | |
wee-slack/wee-slack | 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)) | assert | func_call | _pytest/test_utf8_helpers.py | test_encode_preserves_mapping_type | 68 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
from wee_slack import SlackTS
def test_process_reply(realish_eventrouter, team, channel_general):
message_ts = SlackTS("12341234.123456")
message_text = "reply test"
channel_general.send_message(message_text)
team.ws.add(
{"ok": True, "re... | channel_general.messages | assert | complex_expr | _pytest/test_processreply.py | test_process_reply | 16 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
from wee_slack import url_encode_if_not_encoded
def test_should_url_encode_if_not_encoded():
value = "="
encoded = url_encode_if_not_encoded(value)
assert encoded == | "%3D" | assert | string_literal | _pytest/test_helpers.py | test_should_url_encode_if_not_encoded | 11 | null | |
wee-slack/wee-slack | 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(["æ", "ø", "å"]) | assert | func_call | _pytest/test_utf8_helpers.py | test_encodes_utf8_list_to_unicode | 84 | null | |
wee-slack/wee-slack | 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") | assert | func_call | _pytest/test_utf8_helpers.py | test_encode_preserves_string_without_utf8 | 60 | null | |
wee-slack/wee-slack | 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)) | assert | func_call | _pytest/test_utf8_helpers.py | test_encode_preserves_iterable_type | 75 | null | |
wee-slack/wee-slack | from __future__ import annotations
from itertools import accumulate
from slack.commands import parse_options
from slack.shared import shared
def test_parse_options_with_option_first():
pos_args, options = parse_options("-option1 arg1", options_only_first=False)
assert pos_args == "arg1"
assert options =... | {"option1": True} | assert | collection | tests/test_commands.py | test_parse_options_with_option_first | 27 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import wee_slack
from wee_slack import parse_topic_command, topic_command_cb
from mock import patch
def test_call_topic_with_channel_and_string(realish_eventrouter, channel_general):
current_buffer = channel_general.channel_buffer
wee_slack.EVENTROUTER =... | { "channel": "C407ABS94", "topic": "new topic", } | assert | collection | _pytest/test_topic_command.py | test_call_topic_with_channel_and_string | 98 | null | |
wee-slack/wee-slack | from __future__ import annotations
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
corou... | future.id) | assert_* | complex_expr | tests/test_sleep.py | test_sleep | 20 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import re
from wee_slack import linkify_text
def test_linkifytext_formatting_characters(team):
text = linkify_text("\x02\x1dmy test message\x1d\x02", team)
assert text == | "*_my test message_*" | assert | string_literal | _pytest/test_linkifytext.py | test_linkifytext_formatting_characters | 31 | null | |
wee-slack/wee-slack | 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("æøå") | assert | func_call | _pytest/test_utf8_helpers.py | test_encode_should_not_transform_str | 25 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import re
from wee_slack import linkify_text
def test_linkifytext_with_many_paranthesis(team):
text = linkify_text("@k(o(v)a)())s: my(( test) message", team)
assert text == | "@k(o(v)a)())s: my(( test) message" | assert | string_literal | _pytest/test_linkifytext.py | test_linkifytext_with_many_paranthesis | 37 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
from wee_slack import EventRouter
def test_EventRouter(mock_weechat):
# Sending valid object adds to the queue.
e = EventRouter()
e.receive({})
assert len(e.queue) == 1
# Handling an event removes from the queue.
e = EventRouter()
# ... | 0 | assert | numeric_literal | _pytest/test_eventrouter.py | test_EventRouter | 18 | null | |
wee-slack/wee-slack | from __future__ import annotations
from slack.util import get_cookies
def test_get_cookies_without_key_value_encoded():
cookie = get_cookies("a%2Bb")
assert cookie == | "d=a%2Bb" | assert | string_literal | tests/test_get_cookies.py | test_get_cookies_without_key_value_encoded | 8 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import wee_slack
from wee_slack import parse_topic_command, topic_command_cb
from mock import patch
def test_parse_topic_with_delete():
channel_name, topic = parse_topic_command("/topic -delete")
assert channel_name is None
assert topic == | "" | assert | string_literal | _pytest/test_topic_command.py | test_parse_topic_with_delete | 33 | null | |
wee-slack/wee-slack | from __future__ import annotations
from itertools import accumulate
from slack.commands import parse_options
from slack.shared import shared
def test_all_parent_commands_exist():
for command in shared.commands:
parents = accumulate(command.split(" "), lambda x, y: f"{x} {y}")
for parent in parent... | shared.commands | assert | complex_expr | tests/test_commands.py | test_all_parent_commands_exist | 15 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import json
from wee_slack import SlackTS, command_reply
parent_ts = SlackTS("1485975824.000004")
child_ts = SlackTS("1485975835.000005")
def test_replying_to_child_should_use_parent_ts(
realish_eventrouter, team, channel_general
):
datafiles = [
... | parent_ts | assert | variable | _pytest/test_command_reply.py | test_replying_to_child_should_use_parent_ts | 28 | null | |
wee-slack/wee-slack | from __future__ import annotations
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_... | StopIteration) | pytest.raises | variable | tests/test_hook_process_hashtable.py | test_hook_process_hashtable | 28 | null | |
wee-slack/wee-slack | from __future__ import annotations
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 awaitable... | ("awaitable2", ("awaitable1", ("data",))) | assert | collection | tests/test_task_runner.py | test_run_nested_task | 44 | null | |
wee-slack/wee-slack | from __future__ import annotations
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_diffe... | ts_base_not_padded | assert | variable | tests/test_slackts.py | test_slackts_eq | 18 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
from textwrap import dedent
from wee_slack import SlackRequest
def test_http_check_ratelimited_supports_multiple_headers(realish_eventrouter):
response = (
dedent(
"""
HTTP/1.1 200 Connection established
HTTP/2 20... | '{"ok": true}' | assert | string_literal | _pytest/test_http_check_ratelimited.py | test_http_check_ratelimited_supports_multiple_headers | 27 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import json
def test_process_team_join(realish_eventrouter, team):
# delete charles so we can add him
del team.users["U4096CBHC"]
assert len(team.users) == | 3 | assert | numeric_literal | _pytest/test_processteamjoin.py | test_process_team_join | 10 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import json
from wee_slack import SlackTS
def test_process_message(realish_eventrouter, team, user_alice):
messages = []
messages.append(
json.loads(
open("_pytest/data/websocket/1485975421.33-message.json", "r").read()
)
... | [changed_message_ts] | assert | collection | _pytest/test_process_message.py | test_process_message | 65 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.