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 |
|---|---|---|---|---|---|---|---|---|---|
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.java import get_entities_from_file_java
from swesmith.bug_gen.procedural.java.remove import (
RemoveConditionalModifier,
RemoveAssignModifier,
)
@pytest.mark.parametrize(
"src",
[
"""public int foo(int x) {
if (x > 0) {
return 1;
}
... | None | assert | none_literal | tests/bug_gen/procedural/java/test_java_remove.py | test_remove_conditional_modifier | 37 | null | |
SWE-bench/SWE-smith | import pytest
import subprocess
from swesmith.profiles.golang import GoProfile, Gin3c12d2a8
from unittest.mock import patch, mock_open
def make_dummy_go_profile():
class DummyGoProfile(GoProfile):
owner = "dummy"
repo = "dummyrepo"
commit = "deadbeefcafebabe"
@property
def... | "FAILED" | assert | string_literal | tests/profiles/test_profiles_golang.py | test_go_profile_log_parser_basic | 36 | null | |
SWE-bench/SWE-smith | from swesmith.profiles.rust import RustProfile
def test_rust_profile_log_parser_basic():
profile = RustProfile()
log = """
test test_some_thing ... ok
test test_some_other_thing ... ok
test test_some_failure ... FAILED
test result: FAILED. 2 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in... | "PASSED" | assert | string_literal | tests/profiles/test_profiles_rust.py | test_rust_profile_log_parser_basic | 15 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.harness.eval import matches_instance_filter
class TestInstanceFilterMatching:
def test_exact_match(self):
"""Test exact matching of instance IDs."""
assert matches_instance_filter("exact_match", ["exact_match"]) is | True | assert | bool_literal | tests/harness/test_eval_pattern_matching.py | test_exact_match | TestInstanceFilterMatching | 14 | null |
SWE-bench/SWE-smith | import json
from swebench.harness.constants import (
KEY_INSTANCE_ID,
KEY_MODEL,
KEY_PREDICTION,
TestStatus,
)
from swesmith.harness import grading
def test_get_eval_tests_report_basic():
# Use the imported TestStatus
gold_results = {
"FAIL_TO_PASS": ["test1", "test2"],
"PASS_T... | [] | assert | collection | tests/harness/test_grading.py | test_get_eval_tests_report_basic | 103 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.c import (
get_entities_from_file_c,
)
def entities(test_file_c):
entities = []
get_entities_from_file_c(entities, test_file_c)
return entities
def test_get_entities_from_file_c_max(test_file_c):
entities = []
get_entities_from_file_c(entities, tes... | 3 | assert | numeric_literal | tests/bug_gen/adapters/test_c.py | test_get_entities_from_file_c_max | 22 | null | |
SWE-bench/SWE-smith | import pytest
import re
import warnings
from swesmith.bug_gen.adapters.c_sharp import (
get_entities_from_file_c_sharp,
)
def entities(test_file_c_sharp):
entities = []
get_entities_from_file_c_sharp(entities, test_file_c_sharp)
return entities
def test_get_entities_from_file_c_sharp_unreadable():
... | IOError) | pytest.raises | variable | tests/bug_gen/adapters/test_c_sharp.py | test_get_entities_from_file_c_sharp_unreadable | 24 | null | |
SWE-bench/SWE-smith | import json
import os
import tempfile
from pathlib import Path
from swesmith.train.traj_mgr.collect_trajs import main as collect_trajs
from swesmith.train.traj_mgr.utils import transform_traj_xml
def test_transform_traj_xml_basic(
logs_trajectories, logs_run_evaluation, ft_xml_example
):
# Load a sample traje... | msg | assert | variable | tests/train/traj_mgr/test_collect_trajs.py | test_transform_traj_xml_basic | 35 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.rust import get_entities_from_file_rs
from swesmith.bug_gen.procedural.rust.operations import (
OperationChangeModifier,
OperationFlipOperatorModifier,
OperationSwapOperandsModifier,
OperationBreakChainsModifier,
OperationChangeConstantsModifier,
FLIP... | "*" | assert | string_literal | tests/bug_gen/procedural/rust/test_rust_operations.py | test_operation_flip_operator_mappings | 275 | null | |
SWE-bench/SWE-smith | import re
import warnings
import pytest
from swesmith.bug_gen.adapters.javascript import get_entities_from_file_js
def entities(test_file_js):
entities = []
get_entities_from_file_js(entities, test_file_js)
return entities
def test_get_entities_from_file_js_no_functions(tmp_path):
no_functions_file ... | 0 | assert | numeric_literal | tests/bug_gen/adapters/test_javascript.py | test_get_entities_from_file_js_no_functions | 36 | null | |
SWE-bench/SWE-smith | from swesmith.bug_gen.adapters.php import (
get_entities_from_file_php,
)
def test_get_entities_from_file_php(test_file_php):
entities = []
get_entities_from_file_php(entities, test_file_php)
assert len(entities) == 5
names = [e.name for e in entities]
for name in [
"ControllerDispatche... | signatures | assert | variable | tests/bug_gen/adapters/test_php.py | test_get_entities_from_file_php | 47 | null | |
SWE-bench/SWE-smith | import subprocess
import urllib.error
import pytest
import os
import shutil
from dataclasses import dataclass
from pathlib import Path
from swebench.harness.constants import FAIL_TO_PASS, KEY_INSTANCE_ID
from swesmith.bug_gen.mirror.generate import INSTANCE_REF
from swesmith.constants import KEY_PATCH
from swesmith.co... | 2 | assert | numeric_literal | tests/profiles/test_base.py | test_registry_values | 275 | null | |
SWE-bench/SWE-smith | import pytest
import subprocess
from swesmith.profiles.golang import GoProfile, Gin3c12d2a8
from unittest.mock import patch, mock_open
def make_dummy_go_profile():
class DummyGoProfile(GoProfile):
owner = "dummy"
repo = "dummyrepo"
commit = "deadbeefcafebabe"
@property
def... | result | assert | variable | tests/profiles/test_profiles_golang.py | test_go_profile_log_parser_edge_cases | 65 | null | |
SWE-bench/SWE-smith | import pytest
import re
import warnings
from swesmith.bug_gen.adapters.ruby import (
get_entities_from_file_rb,
)
def ruby_test_file_entities(test_file_ruby):
entities = []
get_entities_from_file_rb(entities, test_file_ruby)
assert len(entities) == 12
return entities
def test_get_entities_from_fil... | 0 | assert | numeric_literal | tests/bug_gen/adapters/test_ruby.py | test_get_entities_from_file_rb_no_functions | 34 | null | |
SWE-bench/SWE-smith | from swesmith.bug_gen.adapters.golang import get_entities_from_file_go
from swesmith.bug_gen.procedural.golang.control_flow import (
ControlIfElseInvertModifier,
ControlShuffleLinesModifier,
)
def test_control_if_else_invert(test_file_go_caddy_usagepool):
entities = []
get_entities_from_file_go(entitie... | 3 | assert | numeric_literal | tests/bug_gen/procedural/golang/test_go_control_flow.py | test_control_if_else_invert | 13 | null | |
SWE-bench/SWE-smith | import pytest
import re
import warnings
from swesmith.bug_gen.adapters.ruby import (
get_entities_from_file_rb,
)
def ruby_test_file_entities(test_file_ruby):
entities = []
get_entities_from_file_rb(entities, test_file_ruby)
assert len(entities) == 12
return entities
def test_ruby_entity_file_posi... | start_end | assert | variable | tests/bug_gen/adapters/test_ruby.py | test_ruby_entity_file_positions | 95 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.javascript import get_entities_from_file_js
from swesmith.bug_gen.procedural.javascript.remove import (
RemoveLoopModifier,
RemoveConditionalModifier,
RemoveAssignmentModifier,
RemoveTernaryModifier,
)
def normalize_code(code: str) -> str:
"""Normalize c... | 1 | assert | numeric_literal | tests/bug_gen/procedural/javascript/test_js_remove.py | test_remove_loop_modifier | 87 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.cpp import get_entities_from_file_cpp
from swesmith.bug_gen.procedural.cpp.replace_strings import ReplaceStringTypoModifier
@pytest.mark.parametrize(
"src",
[
"""void foo() {
const char* msg = "Hello World";
}""",
"""void bar() {
std::string ... | None | assert | none_literal | tests/bug_gen/procedural/cpp/test_cpp_replace_strings.py | test_replace_string_typo_modifier | 32 | null | |
SWE-bench/SWE-smith | import ast
import pytest
from swesmith.bug_gen.adapters.python import (
get_entities_from_file_py,
_build_entity,
)
def parse_func(code):
return ast.parse(code).body[0]
def test_signature_varargs():
code = "def qux(*args, **kwargs): pass"
node = parse_func(code)
assert _build_entity(node, co... | "def qux()" | assert | string_literal | tests/bug_gen/adapters/test_python.py | test_signature_varargs | 35 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.rust import get_entities_from_file_rs
from swesmith.bug_gen.procedural.rust.operations import (
OperationChangeModifier,
OperationFlipOperatorModifier,
OperationSwapOperandsModifier,
OperationBreakChainsModifier,
OperationChangeConstantsModifier,
FLIP... | expected.strip() | assert | func_call | tests/bug_gen/procedural/rust/test_rust_operations.py | test_operation_flip_operator_modifier | 130 | null | |
SWE-bench/SWE-smith | import pytest
import re
import warnings
from swesmith.bug_gen.adapters.golang import (
get_entities_from_file_go,
)
def entities(test_file_go_gin):
entities = []
get_entities_from_file_go(entities, test_file_go_gin)
return entities
@pytest.mark.parametrize(
"func_definition",
[
("func... | 2 | assert | numeric_literal | tests/bug_gen/adapters/test_golang.py | test_get_entities_from_file_go_complexity_other_statements | 217 | null | |
SWE-bench/SWE-smith | import pytest
import re
import warnings
from swesmith.bug_gen.adapters.java import (
get_entities_from_file_java,
)
def entities(test_file_java):
entities = []
get_entities_from_file_java(entities, test_file_java)
return entities
def test_get_entities_from_file_java_signature_param_annotation(tmp_pat... | 1 | assert | numeric_literal | tests/bug_gen/adapters/test_java.py | test_get_entities_from_file_java_signature_param_annotation | 145 | null | |
SWE-bench/SWE-smith | import os
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
from swesmith.profiles.base import _find_ssh_key
class TestFindSshKey:
def test_falls_back_to_default_ssh_keys(self, tmp_path):
ssh_dir = tmp_path / ".ssh"
ssh_dir.mkdir()
ed25519_key = ssh_dir / ... | ed25519_key | assert | variable | tests/harness/test_utils_ssh.py | test_falls_back_to_default_ssh_keys | TestFindSshKey | 40 | null |
SWE-bench/SWE-smith | from unittest.mock import patch
from swesmith.constants import ENV_NAME
from swesmith.profiles.javascript import (
default_npm_install_dockerfile,
parse_log_karma,
parse_log_jasmine,
GithubReadmeStats3e974011,
Commanderjs395cf714,
Colorfef7b619,
)
from swebench.harness.constants import TestStat... | {} | assert | collection | tests/profiles/test_profiles_javascript.py | test_parse_log_karma_no_matches | 40 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.cpp import (
get_entities_from_file_cpp,
)
def entities(test_file_cpp):
entities = []
get_entities_from_file_cpp(entities, test_file_cpp)
return entities
def test_get_entities_from_file_cpp_constructor(tmp_path):
constructor_file = tmp_path / "construc... | "SomeClass()" | assert | string_literal | tests/bug_gen/adapters/test_cpp.py | test_get_entities_from_file_cpp_constructor | 137 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.java import get_entities_from_file_java
from swesmith.bug_gen.procedural.java.operations import (
OperationBreakChainsModifier,
OperationChangeModifier,
OperationChangeConstantsModifier,
OperationFlipOperatorModifier,
OperationSwapOperandsModifier,
)
@py... | 1 | assert | numeric_literal | tests/bug_gen/procedural/java/test_java_operations.py | test_operation_change_modifier | 47 | null | |
SWE-bench/SWE-smith | import pytest
import re
import warnings
from swesmith.bug_gen.adapters.golang import (
get_entities_from_file_go,
)
def entities(test_file_go_gin):
entities = []
get_entities_from_file_go(entities, test_file_go_gin)
return entities
def test_get_entities_from_file_go_unreadable():
with pytest.rai... | IOError) | pytest.raises | variable | tests/bug_gen/adapters/test_golang.py | test_get_entities_from_file_go_unreadable | 28 | null | |
SWE-bench/SWE-smith | from swesmith.profiles.cpp import (
CppProfile,
parse_log_ctest,
parse_log_gtest,
parse_log_catch2,
)
def test_ctest_parser_basic():
"""Test basic CTest output parsing with passed and failed tests."""
log = """
Test project /build
Start 1: test_addition
1/10 Test #1: test_addition ....... | 4 | assert | numeric_literal | tests/profiles/test_profiles_cpp.py | test_ctest_parser_basic | 26 | null | |
SWE-bench/SWE-smith | import pytest
import subprocess
from unittest.mock import patch, mock_open
from swesmith.profiles.java import (
JavaProfile,
parse_log_maven_surefire,
parse_log_gradle_junit_xml,
Gsondd2fe59c,
Eureka459fcf59,
)
from swebench.harness.constants import TestStatus as Status
def make_dummy_java_profile(... | True | assert | bool_literal | tests/profiles/test_profiles_java.py | test_java_profile_build_image_checks_exit_code | 409 | null | |
SWE-bench/SWE-smith | import warnings
import pytest
from swesmith.bug_gen.adapters.typescript import get_entities_from_file_ts
def entities(test_file_ts):
entities = []
get_entities_from_file_ts(entities, test_file_ts)
return entities
def test_get_entities_from_file_ts_count(entities):
# Calculator class, constructor, ad... | 5 | assert | numeric_literal | tests/bug_gen/adapters/test_typescript.py | test_get_entities_from_file_ts_count | 17 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.java import get_entities_from_file_java
from swesmith.bug_gen.procedural.java.remove import (
RemoveConditionalModifier,
RemoveAssignModifier,
)
def test_remove_conditional_modifier_no_block_if(tmp_path):
"""Test conditional removal when the if statement body ha... | result.rewrite | assert | complex_expr | tests/bug_gen/procedural/java/test_java_remove.py | test_remove_conditional_modifier_no_block_if | 61 | null | |
SWE-bench/SWE-smith | from swesmith.profiles.cpp import (
CppProfile,
parse_log_ctest,
parse_log_gtest,
parse_log_catch2,
)
def test_ctest_parser_empty_log():
"""Test CTest parser with empty log."""
result = parse_log_ctest("")
assert result == | {} | assert | collection | tests/profiles/test_profiles_cpp.py | test_ctest_parser_empty_log | 100 | null | |
SWE-bench/SWE-smith | import pytest
import re
import warnings
from swesmith.bug_gen.adapters.golang import (
get_entities_from_file_go,
)
def entities(test_file_go_gin):
entities = []
get_entities_from_file_go(entities, test_file_go_gin)
return entities
def test_get_entities_from_file_go_line_ranges(entities):
start_e... | start_end | assert | variable | tests/bug_gen/adapters/test_golang.py | test_get_entities_from_file_go_line_ranges | 92 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.rust import get_entities_from_file_rs
from swesmith.bug_gen.procedural.rust.operations import (
OperationChangeModifier,
OperationFlipOperatorModifier,
OperationSwapOperandsModifier,
OperationBreakChainsModifier,
OperationChangeConstantsModifier,
FLIP... | "+" | assert | string_literal | tests/bug_gen/procedural/rust/test_rust_operations.py | test_operation_flip_operator_mappings | 273 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.cpp import get_entities_from_file_cpp
from swesmith.bug_gen.procedural.cpp.remove import (
RemoveLoopModifier,
RemoveConditionalModifier,
RemoveAssignModifier,
)
@pytest.mark.parametrize(
"src",
[
"""void foo() {
for (int i = 0; i < 10; i++) ... | None | assert | none_literal | tests/bug_gen/procedural/cpp/test_cpp_remove.py | test_remove_loop_modifier | 47 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.rust import get_entities_from_file_rs
from swesmith.bug_gen.procedural.rust.control_flow import (
ControlIfElseInvertModifier,
ControlShuffleLinesModifier,
)
@pytest.mark.parametrize(
"src,expected",
[
(
"""fn foo(x: i32) -> i32 {
if ... | 1 | assert | numeric_literal | tests/bug_gen/procedural/rust/test_rust_control_flow.py | test_control_if_else_invert_modifier | 73 | null | |
SWE-bench/SWE-smith | from unittest.mock import patch
from swesmith.constants import ENV_NAME
from swesmith.profiles.javascript import (
default_npm_install_dockerfile,
parse_log_karma,
parse_log_jasmine,
GithubReadmeStats3e974011,
Commanderjs395cf714,
Colorfef7b619,
)
from swebench.harness.constants import TestStat... | dockerfile | assert | variable | tests/profiles/test_profiles_javascript.py | test_github_readme_stats_dockerfile_uses_mirror_url | 108 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.constants import ENV_NAME
from unittest.mock import patch, MagicMock, mock_open
from pathlib import Path
def test_python_profile_defaults():
"""Test PythonProfile default values"""
profile = PythonProfile()
assert profile.python_version == | "3.10" | assert | string_literal | tests/profiles/test_profiles_python.py | test_python_profile_defaults | 16 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.rust import get_entities_from_file_rs
from swesmith.bug_gen.procedural.rust.operations import (
OperationChangeModifier,
OperationFlipOperatorModifier,
OperationSwapOperandsModifier,
OperationBreakChainsModifier,
OperationChangeConstantsModifier,
FLIP... | "/" | assert | string_literal | tests/bug_gen/procedural/rust/test_rust_operations.py | test_operation_flip_operator_mappings | 274 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.java import get_entities_from_file_java
from swesmith.bug_gen.procedural.java.wrappers import (
RemoveTryCatchModifier,
RemoveNullCheckModifier,
)
@pytest.mark.parametrize(
"src",
[
"""public void foo() {
try {
doSomething();
} catch ... | 1 | assert | numeric_literal | tests/bug_gen/procedural/java/test_java_wrappers.py | test_remove_try_catch_modifier | 42 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.cpp import get_entities_from_file_cpp
from swesmith.bug_gen.procedural.cpp.operations import (
OperationChangeModifier,
OperationFlipOperatorModifier,
OperationSwapOperandsModifier,
OperationBreakChainsModifier,
OperationChangeConstantsModifier,
FLIPP... | "&" | assert | string_literal | tests/bug_gen/procedural/cpp/test_cpp_operations.py | test_operation_flip_operator_mappings | 360 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.java import get_entities_from_file_java
from swesmith.bug_gen.procedural.java.literals import StringLiteralModifier
@pytest.mark.parametrize(
"src,expected_changes",
[
(
"""public String foo() {
return "true";
}""",
['return "fals... | 1 | assert | numeric_literal | tests/bug_gen/procedural/java/test_java_literals.py | test_string_literal_modifier_swap_pairs | 30 | null | |
SWE-bench/SWE-smith | import pytest
import re
import warnings
from swesmith.bug_gen.adapters.golang import (
get_entities_from_file_go,
)
def entities(test_file_go_gin):
entities = []
get_entities_from_file_go(entities, test_file_go_gin)
return entities
def test_get_entities_from_file_go_analyze_properties_comprehensive(t... | True | assert | bool_literal | tests/bug_gen/adapters/test_golang.py | test_get_entities_from_file_go_analyze_properties_comprehensive | 349 | null | |
SWE-bench/SWE-smith | import subprocess
import urllib.error
import pytest
import os
import shutil
from dataclasses import dataclass
from pathlib import Path
from swebench.harness.constants import FAIL_TO_PASS, KEY_INSTANCE_ID
from swesmith.bug_gen.mirror.generate import INSTANCE_REF
from swesmith.constants import KEY_PATCH
from swesmith.co... | 1 | assert | numeric_literal | tests/profiles/test_base.py | test_prepare_dockerfile_idempotent_syntax | 725 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.cpp import get_entities_from_file_cpp
from swesmith.bug_gen.procedural.cpp.operations import (
OperationChangeModifier,
OperationFlipOperatorModifier,
OperationSwapOperandsModifier,
OperationBreakChainsModifier,
OperationChangeConstantsModifier,
FLIPP... | 1 | assert | numeric_literal | tests/bug_gen/procedural/cpp/test_cpp_operations.py | test_operation_change_modifier | 65 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.constants import ENV_NAME
from unittest.mock import patch, MagicMock, mock_open
from pathlib import Path
def test_python_profile_log_parser_no_matches():
"""Test PythonProfile.log_parser with no matching lines"""
profile = PythonProfile()
log = """
Some random text
No test resu... | {} | assert | collection | tests/profiles/test_profiles_python.py | test_python_profile_log_parser_no_matches | 80 | null | |
SWE-bench/SWE-smith | import pytest
import re
import warnings
from swesmith.bug_gen.adapters.golang import (
get_entities_from_file_go,
)
def entities(test_file_go_gin):
entities = []
get_entities_from_file_go(entities, test_file_go_gin)
return entities
def test_get_entities_from_file_go_complexity_else(tmp_path):
if_... | 7 | assert | numeric_literal | tests/bug_gen/adapters/test_golang.py | test_get_entities_from_file_go_complexity_else | 197 | null | |
SWE-bench/SWE-smith | import pytest
import subprocess
from swesmith.profiles.golang import GoProfile, Gin3c12d2a8
from unittest.mock import patch, mock_open
def make_dummy_go_profile():
class DummyGoProfile(GoProfile):
owner = "dummy"
repo = "dummyrepo"
commit = "deadbeefcafebabe"
@property
def... | "PASSED" | assert | string_literal | tests/profiles/test_profiles_golang.py | test_go_profile_log_parser_basic | 35 | null | |
SWE-bench/SWE-smith | import re
import warnings
import pytest
from swesmith.bug_gen.adapters.javascript import get_entities_from_file_js
def entities(test_file_js):
entities = []
get_entities_from_file_js(entities, test_file_js)
return entities
def test_get_entities_from_file_js_complexity_ternary(tmp_path):
ternary_file... | 1 | assert | numeric_literal | tests/bug_gen/adapters/test_javascript.py | test_get_entities_from_file_js_complexity_ternary | 175 | null | |
SWE-bench/SWE-smith | import pytest
import subprocess
from unittest.mock import patch, mock_open
from swesmith.profiles.java import (
JavaProfile,
parse_log_maven_surefire,
parse_log_gradle_junit_xml,
Gsondd2fe59c,
Eureka459fcf59,
)
from swebench.harness.constants import TestStatus as Status
def make_dummy_java_profile(... | "eureka" | assert | string_literal | tests/profiles/test_profiles_java.py | test_eureka_profile_properties | 304 | null | |
SWE-bench/SWE-smith | from swesmith.bug_gen.llm.utils import extract_code_block
def test_extract_code_block_no_block():
text = "No code block here."
assert extract_code_block(text) == | "" | assert | string_literal | tests/bug_gen/llm/test_utils_llm.py | test_extract_code_block_no_block | 22 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.constants import ENV_NAME
from unittest.mock import patch, MagicMock, mock_open
from pathlib import Path
def test_python_profile_log_parser():
"""Test PythonProfile.log_parser method"""
profile = PythonProfile()
log = """
test_file1.py PASSED
test_file2.py FAILED
test_file3.py ... | "PASSED" | assert | string_literal | tests/profiles/test_profiles_python.py | test_python_profile_log_parser | 65 | null | |
SWE-bench/SWE-smith | import ast
import pytest
from swesmith.bug_gen.adapters.python import (
get_entities_from_file_py,
_build_entity,
)
def parse_func(code):
return ast.parse(code).body[0]
def test_signature_no_args():
code = "def bar(): pass"
node = parse_func(code)
assert _build_entity(node, code, "test.py").... | "def bar()" | assert | string_literal | tests/bug_gen/adapters/test_python.py | test_signature_no_args | 23 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.java import get_entities_from_file_java
from swesmith.bug_gen.procedural.java.boolean import (
BooleanNegateModifier,
)
@pytest.mark.parametrize(
"src,expected_changes",
[
(
"""public boolean foo() {
return true;
}""",
["false... | 1 | assert | numeric_literal | tests/bug_gen/procedural/java/test_java_boolean.py | test_boolean_negate_modifier | 78 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.c import (
get_entities_from_file_c,
)
def entities(test_file_c):
entities = []
get_entities_from_file_c(entities, test_file_c)
return entities
def test_get_entities_from_file_c_unreadable():
with pytest.raises( | IOError) | pytest.raises | variable | tests/bug_gen/adapters/test_c.py | test_get_entities_from_file_c_unreadable | 26 | null | |
SWE-bench/SWE-smith | from swesmith.bug_gen.adapters.java import get_entities_from_file_java
from swesmith.bug_gen.procedural.java.returns import ReturnNullModifier
def test_return_null_modifier_reference_return_type(tmp_path):
"""Test that reference-typed returns can be rewritten to null."""
src = """public String foo(String s) {
... | result.rewrite | assert | complex_expr | tests/bug_gen/procedural/java/test_java_returns.py | test_return_null_modifier_reference_return_type | 21 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.cpp import (
get_entities_from_file_cpp,
)
def entities(test_file_cpp):
entities = []
get_entities_from_file_cpp(entities, test_file_cpp)
return entities
def test_get_entities_from_file_cpp_constructor(tmp_path):
constructor_file = tmp_path / "construc... | 1 | assert | numeric_literal | tests/bug_gen/adapters/test_cpp.py | test_get_entities_from_file_cpp_constructor | 135 | null | |
SWE-bench/SWE-smith | from swesmith.bug_gen.adapters.php import (
get_entities_from_file_php,
)
def test_get_entities_from_file_php_max(test_file_php):
"""Should cap the number of returned entities when *max_entities* is set."""
entities: list = []
get_entities_from_file_php(entities, test_file_php, 3)
# Only three ent... | 3 | assert | numeric_literal | tests/bug_gen/adapters/test_php.py | test_get_entities_from_file_php_max | 69 | null | |
SWE-bench/SWE-smith | import json
import pytest
from swesmith.harness.eval import main as run_evaluation
@pytest.mark.parametrize(
"instance_id",
[
"pandas-dev__pandas.95280573.pr_53652",
"pydantic__pydantic.acb0f10f.pr_8316",
],
)
def test_eval_artifacts_exist_and_valid(logs_run_evaluation, instance_id):
i... | report | assert | variable | tests/harness/test_eval.py | test_eval_artifacts_exist_and_valid | 38 | null | |
SWE-bench/SWE-smith | import pytest
import re
import warnings
from swesmith.bug_gen.adapters.ruby import (
get_entities_from_file_rb,
)
def ruby_test_file_entities(test_file_ruby):
entities = []
get_entities_from_file_rb(entities, test_file_ruby)
assert len(entities) == 12
return entities
def test_ruby_entity_one_line_... | 1 | assert | numeric_literal | tests/bug_gen/adapters/test_ruby.py | test_ruby_entity_one_line_method | 142 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.rust import get_entities_from_file_rs
from swesmith.bug_gen.procedural.rust.operations import (
OperationChangeModifier,
OperationFlipOperatorModifier,
OperationSwapOperandsModifier,
OperationBreakChainsModifier,
OperationChangeConstantsModifier,
FLIP... | "-" | assert | string_literal | tests/bug_gen/procedural/rust/test_rust_operations.py | test_operation_flip_operator_mappings | 272 | null | |
SWE-bench/SWE-smith | import pytest
import re
import warnings
from swesmith.bug_gen.adapters.c_sharp import (
get_entities_from_file_c_sharp,
)
def entities(test_file_c_sharp):
entities = []
get_entities_from_file_c_sharp(entities, test_file_c_sharp)
return entities
def test_get_entities_from_file_c_sharp_finalizer(tmp_pa... | "~SomeClass()" | assert | string_literal | tests/bug_gen/adapters/test_c_sharp.py | test_get_entities_from_file_c_sharp_finalizer | 65 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.java import get_entities_from_file_java
from swesmith.bug_gen.procedural.java.literals import StringLiteralModifier
def test_string_literal_modifier_fallback_mutation(tmp_path):
"""Test fallback mutation when no swap pair matches."""
src = """public String foo() {
... | result.rewrite | assert | complex_expr | tests/bug_gen/procedural/java/test_java_literals.py | test_string_literal_modifier_fallback_mutation | 57 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.cpp import (
get_entities_from_file_cpp,
)
def entities(test_file_cpp):
entities = []
get_entities_from_file_cpp(entities, test_file_cpp)
return entities
def test_get_entities_from_file_cpp_no_functions(tmp_path):
no_functions_file = tmp_path / "no_fun... | 0 | assert | numeric_literal | tests/bug_gen/adapters/test_cpp.py | test_get_entities_from_file_cpp_no_functions | 127 | null | |
SWE-bench/SWE-smith | import ast
import os
import shutil
import tempfile
import unittest
from unittest.mock import Mock
from pathlib import Path
from swesmith.bug_gen.adapters.python import _build_entity
from swesmith.bug_gen import utils
class TestUtils(unittest.TestCase):
def setUp(self):
self.test_dir = tempfile.mkdtemp()
... | content) | self.assertIn | variable | tests/bug_gen/test_utils.py | test_apply_code_change | TestUtils | 44 | null |
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.cpp import (
get_entities_from_file_cpp,
)
def entities(test_file_cpp):
entities = []
get_entities_from_file_cpp(entities, test_file_cpp)
return entities
def test_get_entities_from_file_cpp_unreadable():
with pytest.raises( | IOError) | pytest.raises | variable | tests/bug_gen/adapters/test_cpp.py | test_get_entities_from_file_cpp_unreadable | 22 | null | |
SWE-bench/SWE-smith | import warnings
import pytest
from swesmith.bug_gen.adapters.typescript import get_entities_from_file_ts
def entities(test_file_ts):
entities = []
get_entities_from_file_ts(entities, test_file_ts)
return entities
def test_get_entities_from_file_ts_stub(tmp_path):
"""Test stub generation."""
ts_f... | stub | assert | variable | tests/bug_gen/adapters/test_typescript.py | test_get_entities_from_file_ts_stub | 322 | null | |
SWE-bench/SWE-smith | import os
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
from swesmith.profiles.base import _find_ssh_key
class TestFindSshKey:
def test_returns_env_var_path_when_exists(self, tmp_path):
key_file = tmp_path / "my_key"
key_file.write_text("fake key")
wit... | Path(key_file) | assert | func_call | tests/harness/test_utils_ssh.py | test_returns_env_var_path_when_exists | TestFindSshKey | 20 | null |
SWE-bench/SWE-smith | import pytest
import re
import warnings
from swesmith.bug_gen.adapters.golang import (
get_entities_from_file_go,
)
def entities(test_file_go_gin):
entities = []
get_entities_from_file_go(entities, test_file_go_gin)
return entities
def test_get_entities_from_file_go_no_functions(tmp_path):
no_fun... | 0 | assert | numeric_literal | tests/bug_gen/adapters/test_golang.py | test_get_entities_from_file_go_no_functions | 37 | null | |
SWE-bench/SWE-smith | import pytest
import re
import warnings
from swesmith.bug_gen.adapters.ruby import (
get_entities_from_file_rb,
)
def ruby_test_file_entities(test_file_ruby):
entities = []
get_entities_from_file_rb(entities, test_file_ruby)
assert len(entities) == 12
return entities
@pytest.mark.parametrize(
... | 2 | assert | numeric_literal | tests/bug_gen/adapters/test_ruby.py | test_get_entities_from_file_ruby_complexity_other_expressions | 203 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.cpp import get_entities_from_file_cpp
from swesmith.bug_gen.procedural.cpp.remove import (
RemoveLoopModifier,
RemoveConditionalModifier,
RemoveAssignModifier,
)
@pytest.mark.parametrize(
"src",
[
"""void foo() {
for (int i = 0; i < 10; i++) ... | 1 | assert | numeric_literal | tests/bug_gen/procedural/cpp/test_cpp_remove.py | test_remove_loop_modifier | 42 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.cpp import get_entities_from_file_cpp
from swesmith.bug_gen.procedural.cpp.control_flow import (
ControlIfElseInvertModifier,
ControlShuffleLinesModifier,
)
def test_control_if_else_else_if_chain(tmp_path):
"""Test that ControlIfElseInvertModifier handles else-i... | src | assert | variable | tests/bug_gen/procedural/cpp/test_cpp_control_flow.py | test_control_if_else_else_if_chain | 131 | null | |
SWE-bench/SWE-smith | import re
import warnings
import pytest
from swesmith.bug_gen.adapters.javascript import get_entities_from_file_js
def entities(test_file_js):
entities = []
get_entities_from_file_js(entities, test_file_js)
return entities
def test_get_entities_from_file_js_stubs(entities):
stubs = [e.stub for e in ... | stubs | assert | variable | tests/bug_gen/adapters/test_javascript.py | test_get_entities_from_file_js_stubs | 142 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.constants import ENV_NAME
from unittest.mock import patch, MagicMock, mock_open
from pathlib import Path
def test_python_profile_log_parser():
"""Test PythonProfile.log_parser method"""
profile = PythonProfile()
log = """
test_file1.py PASSED
test_file2.py FAILED
test_file3.py ... | "SKIPPED" | assert | string_literal | tests/profiles/test_profiles_python.py | test_python_profile_log_parser | 67 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.javascript import get_entities_from_file_js
from swesmith.bug_gen.procedural.javascript.operations import (
OperationChangeModifier,
OperationFlipOperatorModifier,
OperationSwapOperandsModifier,
OperationChangeConstantsModifier,
OperationBreakChainsModifi... | expected.strip() | assert | func_call | tests/bug_gen/procedural/javascript/test_js_operations.py | test_operation_flip_operator_modifier | 133 | null | |
SWE-bench/SWE-smith | import re
import warnings
import pytest
from swesmith.bug_gen.adapters.javascript import get_entities_from_file_js
def entities(test_file_js):
entities = []
get_entities_from_file_js(entities, test_file_js)
return entities
def test_get_entities_from_file_js_max(test_file_js):
entities = []
get_e... | 3 | assert | numeric_literal | tests/bug_gen/adapters/test_javascript.py | test_get_entities_from_file_js_max | 23 | null | |
SWE-bench/SWE-smith | import json
import pytest
from swesmith.harness.eval import main as run_evaluation
@pytest.mark.parametrize(
"instance_id",
[
"pandas-dev__pandas.95280573.pr_53652",
"pydantic__pydantic.acb0f10f.pr_8316",
],
)
def test_eval_artifacts_exist_and_valid(logs_run_evaluation, instance_id):
i... | content | assert | variable | tests/harness/test_eval.py | test_eval_artifacts_exist_and_valid | 45 | null | |
SWE-bench/SWE-smith | import pytest
import subprocess
from unittest.mock import patch, mock_open
from swesmith.profiles.java import (
JavaProfile,
parse_log_maven_surefire,
parse_log_gradle_junit_xml,
Gsondd2fe59c,
Eureka459fcf59,
)
from swebench.harness.constants import TestStatus as Status
def make_dummy_java_profile(... | "google" | assert | string_literal | tests/profiles/test_profiles_java.py | test_gson_profile_properties | 269 | null | |
SWE-bench/SWE-smith | import json
import os
import tempfile
from pathlib import Path
from swesmith.train.traj_mgr.collect_trajs import main as collect_trajs
from swesmith.train.traj_mgr.utils import transform_traj_xml
def test_transform_traj_xml_basic(
logs_trajectories, logs_run_evaluation, ft_xml_example
):
# Load a sample traje... | content | assert | variable | tests/train/traj_mgr/test_collect_trajs.py | test_transform_traj_xml_basic | 44 | null | |
SWE-bench/SWE-smith | import ast
import os
import shutil
import tempfile
import unittest
from unittest.mock import Mock
from pathlib import Path
from swesmith.bug_gen.adapters.python import _build_entity
from swesmith.bug_gen import utils
class TestUtils(unittest.TestCase):
def setUp(self):
self.test_dir = tempfile.mkdtemp()
... | bug_dir) | self.assertEqual | variable | tests/bug_gen/test_utils.py | test_get_bug_directory | TestUtils | 118 | null |
SWE-bench/SWE-smith | from swesmith.bug_gen.adapters.java import get_entities_from_file_java
from swesmith.bug_gen.procedural.java.returns import ReturnNullModifier
def test_return_null_modifier_reference_return_type(tmp_path):
"""Test that reference-typed returns can be rewritten to null."""
src = """public String foo(String s) {
... | None | assert | none_literal | tests/bug_gen/procedural/java/test_java_returns.py | test_return_null_modifier_reference_return_type | 20 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.java import get_entities_from_file_java
from swesmith.bug_gen.procedural.java.loops import (
LoopBreakContinueSwapModifier,
LoopOffByOneModifier,
)
@pytest.mark.parametrize(
"src,expected_swap",
[
(
"""public void foo() {
for (int i =... | result.rewrite | assert | complex_expr | tests/bug_gen/procedural/java/test_java_loops.py | test_loop_break_continue_swap_modifier | 49 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.java import get_entities_from_file_java
from swesmith.bug_gen.procedural.java.control_flow import (
ControlIfElseInvertModifier,
)
@pytest.mark.parametrize(
"src,expected",
[
(
"""public int foo(int x) {
if (x > 0) {
return 1;
... | expected.strip() | assert | func_call | tests/bug_gen/procedural/java/test_java_control_flow.py | test_control_if_else_invert_modifier | 78 | null | |
SWE-bench/SWE-smith | import pytest
import subprocess
from unittest.mock import patch, mock_open
from swesmith.profiles.typescript import (
TypeScriptProfile,
CrossEnv9951937a,
Trpc2f40ba93,
ClassValidator977d2c70,
Rxjsc15b37f8,
default_npm_install_dockerfile,
default_pnpm_install_dockerfile,
)
from swesmith.cons... | "trpc" | assert | string_literal | tests/profiles/test_profiles_typescript.py | test_trpc_profile_properties | 146 | null | |
SWE-bench/SWE-smith | import pytest
import subprocess
from swesmith.profiles.golang import GoProfile, Gin3c12d2a8
from unittest.mock import patch, mock_open
def make_dummy_go_profile():
class DummyGoProfile(GoProfile):
owner = "dummy"
repo = "dummyrepo"
commit = "deadbeefcafebabe"
@property
def... | {} | assert | collection | tests/profiles/test_profiles_golang.py | test_go_profile_log_parser_no_matches | 49 | null | |
SWE-bench/SWE-smith | import pytest
import re
import warnings
from swesmith.bug_gen.adapters.rust import (
get_entities_from_file_rs,
)
def entities(test_file_rust):
entities = []
get_entities_from_file_rs(entities, test_file_rust)
return entities
def test_get_entities_from_file_rs_no_functions(tmp_path):
no_functions... | 0 | assert | numeric_literal | tests/bug_gen/adapters/test_rust.py | test_get_entities_from_file_rs_no_functions | 37 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.javascript import get_entities_from_file_js
from swesmith.bug_gen.procedural.javascript.control_flow import (
ControlIfElseInvertModifier,
ControlShuffleLinesModifier,
)
@pytest.mark.parametrize(
"src,expected",
[
# Simple if-else inversion
(... | None | assert | none_literal | tests/bug_gen/procedural/javascript/test_js_control_flow.py | test_control_if_else_invert_modifier | 64 | null | |
SWE-bench/SWE-smith | import json
from swebench.harness.constants import (
KEY_INSTANCE_ID,
KEY_MODEL,
KEY_PREDICTION,
TestStatus,
)
from swesmith.harness import grading
def test_get_eval_tests_report_basic():
# Use the imported TestStatus
gold_results = {
"FAIL_TO_PASS": ["test1", "test2"],
"PASS_T... | ["test1"] | assert | collection | tests/harness/test_grading.py | test_get_eval_tests_report_basic | 100 | null | |
SWE-bench/SWE-smith | from swesmith.profiles.rust import RustProfile
def test_rust_profile_log_parser_no_matches():
profile = RustProfile()
log = """
running 101 tests
Some random output
test result: ok. 101 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
"""
result = profile.log_parser(log)
asse... | {} | assert | collection | tests/profiles/test_profiles_rust.py | test_rust_profile_log_parser_no_matches | 28 | null | |
SWE-bench/SWE-smith | import re
import warnings
import pytest
from swesmith.bug_gen.adapters.javascript import get_entities_from_file_js
def entities(test_file_js):
entities = []
get_entities_from_file_js(entities, test_file_js)
return entities
def test_get_entities_from_file_js_nested_functions(tmp_path):
nested_file = ... | names | assert | variable | tests/bug_gen/adapters/test_javascript.py | test_get_entities_from_file_js_nested_functions | 278 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.java import get_entities_from_file_java
from swesmith.bug_gen.procedural.java.literals import StringLiteralModifier
@pytest.mark.parametrize(
"src,expected_changes",
[
(
"""public String foo() {
return "true";
}""",
['return "fals... | None | assert | none_literal | tests/bug_gen/procedural/java/test_java_literals.py | test_string_literal_modifier_swap_pairs | 35 | null | |
SWE-bench/SWE-smith | import pytest
import re
import warnings
from swesmith.bug_gen.adapters.ruby import (
get_entities_from_file_rb,
)
def ruby_test_file_entities(test_file_ruby):
entities = []
get_entities_from_file_rb(entities, test_file_ruby)
assert len(entities) == 12
return entities
def test_get_entities_from_fil... | 3 | assert | numeric_literal | tests/bug_gen/adapters/test_ruby.py | test_get_entities_from_file_rb_max | 20 | null | |
SWE-bench/SWE-smith | from swesmith.bug_gen.adapters.php import (
get_entities_from_file_php,
)
def test_get_entities_from_file_php(test_file_php):
entities = []
get_entities_from_file_php(entities, test_file_php)
assert len(entities) == 5
names = [e.name for e in entities]
for name in [
"ControllerDispatche... | names | assert | variable | tests/bug_gen/adapters/test_php.py | test_get_entities_from_file_php | 18 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.cpp import (
get_entities_from_file_cpp,
)
def entities(test_file_cpp):
entities = []
get_entities_from_file_cpp(entities, test_file_cpp)
return entities
def test_get_entities_from_file_cpp_max(test_file_cpp):
entities = []
get_entities_from_file_c... | 3 | assert | numeric_literal | tests/bug_gen/adapters/test_cpp.py | test_get_entities_from_file_cpp_max | 18 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.rust import get_entities_from_file_rs
from swesmith.bug_gen.procedural.rust.operations import (
OperationChangeModifier,
OperationFlipOperatorModifier,
OperationSwapOperandsModifier,
OperationBreakChainsModifier,
OperationChangeConstantsModifier,
FLIP... | ">" | assert | string_literal | tests/bug_gen/procedural/rust/test_rust_operations.py | test_operation_flip_operator_mappings | 278 | null | |
SWE-bench/SWE-smith | import subprocess
import urllib.error
import pytest
import os
import shutil
from dataclasses import dataclass
from pathlib import Path
from swebench.harness.constants import FAIL_TO_PASS, KEY_INSTANCE_ID
from swesmith.bug_gen.mirror.generate import INSTANCE_REF
from swesmith.constants import KEY_PATCH
from swesmith.co... | True | assert | bool_literal | tests/profiles/test_base.py | test_repo_profile_clone | 77 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.cpp import get_entities_from_file_cpp
from swesmith.bug_gen.procedural.cpp.control_flow import (
ControlIfElseInvertModifier,
ControlShuffleLinesModifier,
)
def test_control_if_else_invert_bare_if(tmp_path):
"""Test that ControlIfElseInvertModifier handles bare ... | expected.strip() | assert | func_call | tests/bug_gen/procedural/cpp/test_cpp_control_flow.py | test_control_if_else_invert_bare_if | 85 | null | |
SWE-bench/SWE-smith | import pytest
from swesmith.bug_gen.adapters.c import (
get_entities_from_file_c,
)
def entities(test_file_c):
entities = []
get_entities_from_file_c(entities, test_file_c)
return entities
def test_get_entities_from_file_c_multi_line_signature(tmp_path):
multi_line_signature_file = tmp_path / "mu... | 1 | assert | numeric_literal | tests/bug_gen/adapters/test_c.py | test_get_entities_from_file_c_multi_line_signature | 123 | null | |
SWE-bench/SWE-smith | import warnings
import pytest
from swesmith.bug_gen.adapters.typescript import get_entities_from_file_ts
def entities(test_file_ts):
entities = []
get_entities_from_file_ts(entities, test_file_ts)
return entities
def test_get_entities_from_file_ts_max(test_file_ts):
entities = []
get_entities_fr... | 3 | assert | numeric_literal | tests/bug_gen/adapters/test_typescript.py | test_get_entities_from_file_ts_max | 23 | null | |
SWE-bench/SWE-smith | from swesmith.bug_gen.adapters.php import (
get_entities_from_file_php,
)
def test_get_entities_from_file_php_no_entities(tmp_path):
"""A PHP file with no top-level functions, methods or classes yields no entities."""
no_entities_file = tmp_path / "no_entities.php"
no_entities_file.write_text("<?php\n/... | 0 | assert | numeric_literal | tests/bug_gen/adapters/test_php.py | test_get_entities_from_file_php_no_entities | 93 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.