Dataset Viewer
Auto-converted to Parquet Duplicate
rubric_id
stringlengths
12
12
criterion_sha256
stringlengths
16
16
retrieval_text
stringlengths
7
1.02k
prompt_block
stringlengths
9
1.02k
family
stringclasses
2 values
predicate
stringclasses
2 values
title
stringlengths
7
187
input_condition
stringlengths
0
660
code_requirement
stringlengths
0
839
prediction
stringlengths
0
904
target_failing_test
stringlengths
0
190
target_exception_class
stringclasses
7 values
text
stringlengths
11
3.02k
source_file
stringlengths
78
148
source_instance_id
stringlengths
15
70
source_repo
stringclasses
102 values
source_dataset
stringclasses
2 values
library
stringclasses
1 value
library_target
int64
1k
1k
3c4186f5405f
1cc085fad416544b
`pagify` is a plain generator with no `__length_hint__`, so remaining-page count is always 0 `operator.length_hint` falls back to `__len__` then `__length_hint__`; a generator object defines neither, so `length_hint` returns its default of `0`. The very first assertion `operator.length_hint(it) == 10` compares `0 == 10...
- `pagify` is a plain generator with no `__length_hint__`, so remaining-page count is always 0 `operator.length_hint` falls back to `__len__` then `__length_hint__`; a generator object defines neither, so `length_hint` returns its default of `0`. The very first assertion `operator.length_hint(it) == 10` compares `0...
perf_spec
a named unit test will fail
`pagify` is a plain generator with no `__length_hint__`, so remaining-page count is always 0
`code`: the submitted diff only edits `redbot/core/commands/converter.py::_parse_and_match`; `redbot.core.utils.chat_formatting.pagify` is left as a generator function (`yield` inside a plain `def`) and no iterator class implementing `__length_hint__` is added.
the test does `it = pagify("A" * 100, shorten_by=0, page_length=10)` and asserts `operator.length_hint(it) == remaining` with `remaining = 100 // 10` (i.e. 10) *before* any iteration, then after each `for page in it` asserts the hint has decremented by one, ending at `0`.
`operator.length_hint` falls back to `__len__` then `__length_hint__`; a generator object defines neither, so `length_hint` returns its default of `0`. The very first assertion `operator.length_hint(it) == 10` compares `0 == 10` and fails immediately — the test cannot pass without `pagify` returning an object that expo...
tests/core/test_utils.py::test_pagify_length_hint
### `pagify` is a plain generator with no `__length_hint__`, so remaining-page count is always 0 - **Input condition**: `code`: the submitted diff only edits `redbot/core/commands/converter.py::_parse_and_match`; `redbot.core.utils.chat_formatting.pagify` is left as a generator function (`yield` inside a plain `def`) a...
stb1000r1__Cog-Creators__Red-DiscordBot.33e0eac7.combine_module__886ywrvb__spec__pagify--is-a-plain-generator-with-no----len__3c4186f5405f.md
Cog-Creators__Red-DiscordBot.33e0eac7.combine_module__886ywrvb
Cog-Creators/Red-DiscordBot
swe-smith
swe_1000
1,000
e9591eb935b2
927018fd856dd25e
`_settings_caches.py` is truncated mid-docstring, leaving an unterminated string literal that breaks import of `redbot.core` the triple-quoted docstring beginning `"""` under `cog_disabled_in_guild` is never closed, so Python raises `SyntaxError: unterminated triple-quoted string literal` when compiling `_settings_cach...
- `_settings_caches.py` is truncated mid-docstring, leaving an unterminated string literal that breaks import of `redbot.core` the triple-quoted docstring beginning `"""` under `cog_disabled_in_guild` is never closed, so Python raises `SyntaxError: unterminated triple-quoted string literal` when compiling `_setting...
perf_spec
a named unit test will fail
`_settings_caches.py` is truncated mid-docstring, leaving an unterminated string literal that breaks import of `redbot.core`
`code`: the diff deletes everything after the opening of `cog_disabled_in_guild`'s docstring in `redbot/core/_settings_caches.py` — the file now ends with ` guild_id: int` inside a `"""` block whose closing `"""` (and the `return gset` body, plus `default_disable`, `default_enable`, `disable_cog_in_guild`, `enable_cog_...
the test does `from redbot.pytest.mod import *` and then `case = await mod.create_case(bot, guild, created_at, case_type, usr, moderator, reason)` followed by `assert case is not None`, `assert case.user == usr`, `assert case.created_at == int(created_at.timestamp())`. Reaching those calls requires `redbot.core._settin...
the triple-quoted docstring beginning `"""` under `cog_disabled_in_guild` is never closed, so Python raises `SyntaxError: unterminated triple-quoted string literal` when compiling `_settings_caches.py`. The import chain for `redbot.pytest.mod` therefore fails at collection, `mod.create_case` is never reached, and every...
tests/cogs/test_mod.py::test_modlog_case_create
### `_settings_caches.py` is truncated mid-docstring, leaving an unterminated string literal that breaks import of `redbot.core` - **Input condition**: `code`: the diff deletes everything after the opening of `cog_disabled_in_guild`'s docstring in `redbot/core/_settings_caches.py` — the file now ends with ` guil...
stb1000r1__Cog-Creators__Red-DiscordBot.33e0eac7.func_pm_class_rm_funcs__89fq1woh__spec__settings-caches-py--is-truncated-mid-docst__e9591eb935b2.md
Cog-Creators__Red-DiscordBot.33e0eac7.func_pm_class_rm_funcs__89fq1woh
Cog-Creators/Red-DiscordBot
swe-smith
swe_1000
1,000
b1417fe4069e
a3990be169266709
`zip(A_shape, B_shape)` silently truncates the interleaved reshape when the two operands have different ndim For `np.kron(R(5), R(3,3))`, numpy promotes the 1-D operand to shape `(1,5)` and returns an array of shape `(3,15)`, so the incoming cotangent `G` has 45 elements. But `A_shape = (5,)` and `B_shape = (3,3)`, so ...
- `zip(A_shape, B_shape)` silently truncates the interleaved reshape when the two operands have different ndim For `np.kron(R(5), R(3,3))`, numpy promotes the 1-D operand to shape `(1,5)` and returns an array of shape `(3,15)`, so the incoming cotangent `G` has 45 elements. But `A_shape = (5,)` and `B_shape = (3,3)...
perf_spec
a named unit test will fail
`zip(A_shape, B_shape)` silently truncates the interleaved reshape when the two operands have different ndim
`code`: `grad_kron` builds `reshape_shape` by `for a_dim, b_dim in zip(A_shape, B_shape)` and then calls `anp.reshape(G, reshape_shape)`, with no step that left-pads the shorter of `A_shape`/`B_shape` with 1s so both have `max(A.ndim, B.ndim)` entries (the only padding present is the special case setting `B_shape = (1,...
`test_kron` runs `combo_check(np.kron, [0, 1])` over the cross product of `[R(5,5), R(4,4), R(5), R(5,1), R(1,5), R(), C(5,5)]` with `[R(3,3), R(2,2), R(3), R(1,3), R(3,1), R(), C(3,3)]`, so it takes the VJP of `np.kron` for mixed-rank pairs such as `R(5)` (ndim 1) with `R(3,3)` (ndim 2), and requires each of those gra...
For `np.kron(R(5), R(3,3))`, numpy promotes the 1-D operand to shape `(1,5)` and returns an array of shape `(3,15)`, so the incoming cotangent `G` has 45 elements. But `A_shape = (5,)` and `B_shape = (3,3)`, so `zip` yields only one pair and `reshape_shape == (5, 3)`, i.e. 15 elements; `anp.reshape(G, (5,3))` raises `V...
tests/test_systematic.py::test_kron
### `zip(A_shape, B_shape)` silently truncates the interleaved reshape when the two operands have different ndim - **Input condition**: `code`: `grad_kron` builds `reshape_shape` by `for a_dim, b_dim in zip(A_shape, B_shape)` and then calls `anp.reshape(G, reshape_shape)`, with no step that left-pads the shorter of `A_...
stb1000r1__HIPS__autograd.ac044f0d.lm_rewrite__fh3evj1w__spec__zip-a-shape--b-shape---silently-truncates-t__b1417fe4069e.md
HIPS__autograd.ac044f0d.lm_rewrite__fh3evj1w
HIPS/autograd
swe-smith
swe_1000
1,000
e8c902acdedd
ed5bb46973ff7036
`grad_np_std` has no `num_reps <= 1` short-circuit, so single-element reductions with `ddof=1` divide by zero
- `grad_np_std` has no `num_reps <= 1` short-circuit, so single-element reductions with `ddof=1` divide by zero
perf_spec
a named unit test will fail
`grad_np_std` has no `num_reps <= 1` short-circuit, so single-element reductions with `ddof=1` divide by zero
`code`: the `vjp` returned by `grad_np_std` in `autograd/numpy/numpy_vjps.py` unconditionally returns `g_repeated * x_minus_mean / ((num_reps - ddof) * anp.std(x, axis=axis, keepdims=True, ddof=ddof))`, with no branch that returns zeros when the number of elements being reduced is 1 (the upstream code guards with `if n...
`test_std` calls `stat_check(np.std)`, which runs `combo_check(np.std, (0,))` over `[x, A, B, C, D]` with `axis=[None, 0]` and over `[C, D]` with `axis=[None, 0, 1]`, including `ddof=[0, 1]` — i.e. it demands a finite, numerically-correct VJP for cases such as `grad(np.std)(3.5, ddof=1)`
tests/test_systematic.py::test_std
### `grad_np_std` has no `num_reps <= 1` short-circuit, so single-element reductions with `ddof=1` divide by zero - **Input condition**: `code`: the `vjp` returned by `grad_np_std` in `autograd/numpy/numpy_vjps.py` unconditionally returns `g_repeated * x_minus_mean / ((num_reps - ddof) * anp.std(x, axis=axis, keepdims=...
stb1000r1__HIPS__autograd.ac044f0d.lm_rewrite__ki4lth6m__spec__grad-np-std--has-no--num-reps----1--short-c__e8c902acdedd.md
HIPS__autograd.ac044f0d.lm_rewrite__ki4lth6m
HIPS/autograd
swe-smith
swe_1000
1,000
3bb84216e4a2
d2a4264f00f8c53d
`shrink_types` still requires the `max_typed_dict_size` positional argument, so stub generation raises TypeError when `cli.main` builds the stub it reaches the single-argument call `shrink_types(types)`; because the parameter is still mandatory, Python raises `TypeError: shrink_types() missing 1 required positional arg...
- `shrink_types` still requires the `max_typed_dict_size` positional argument, so stub generation raises TypeError when `cli.main` builds the stub it reaches the single-argument call `shrink_types(types)`; because the parameter is still mandatory, Python raises `TypeError: shrink_types() missing 1 required position...
perf_spec
a named unit test will fail
`shrink_types` still requires the `max_typed_dict_size` positional argument, so stub generation raises TypeError
`code`: the diff only adds a `rewrite` dispatch method to `GenericTypeRewriter` in `monkeytype/typing.py`; the `def shrink_types(types, max_typed_dict_size)` signature is untouched, and the internal callers (stub/trace-rewriting code reached from `cli.main(['stub', ...])`) invoke it as `shrink_types(types)` with a sing...
the test calls `ret = cli.main(['stub', func.__module__], stdout, stderr)` after storing `CallTrace(func, {'a': int, 'b': str}, NoneType)` and `CallTrace(func2, {'a': int, 'b': int}, NoneType)`, and asserts `stdout.getvalue() == "def func(a: int, b: str) -> None: ...\n\n\ndef func2(a: int, b: int) -> None: ...\n"`, `st...
when `cli.main` builds the stub it reaches the single-argument call `shrink_types(types)`; because the parameter is still mandatory, Python raises `TypeError: shrink_types() missing 1 required positional argument: 'max_typed_dict_size'`. The CLI's error handling writes a message to `stderr` and returns a non-zero code ...
tests/test_cli.py::test_generate_stub
### `shrink_types` still requires the `max_typed_dict_size` positional argument, so stub generation raises TypeError - **Input condition**: `code`: the diff only adds a `rewrite` dispatch method to `GenericTypeRewriter` in `monkeytype/typing.py`; the `def shrink_types(types, max_typed_dict_size)` signature is untouched...
stb1000r1__Instagram__MonkeyType.70c3acf6.pr_168__spec__shrink-types--still-requires-the--max-typed__3bb84216e4a2.md
Instagram__MonkeyType.70c3acf6.pr_168
Instagram/MonkeyType
swe-smith
swe_1000
1,000
dd36a1ebd204
2139360c390a415d
`list-modules` subcommand and its handler were never re-added to the CLI parser with no `list-modules` choice registered on the subparsers object, `parser.parse_args(['list-modules'])` treats it as an invalid choice, so argparse writes a usage/error message to `sys.stderr` and raises `SystemExit(2)` before any handler ...
- `list-modules` subcommand and its handler were never re-added to the CLI parser with no `list-modules` choice registered on the subparsers object, `parser.parse_args(['list-modules'])` treats it as an invalid choice, so argparse writes a usage/error message to `sys.stderr` and raises `SystemExit(2)` before any ha...
perf_spec
a named unit test will fail
`list-modules` subcommand and its handler were never re-added to the CLI parser
`code`: the diff to `monkeytype/cli.py` only inserts `args.config = get_monkeytype_config(args.config)`; `main()` still registers only the other subparsers (e.g. `stub_parser` … `stub_parser.set_defaults(handler=print_stub_handler)`) and defines no `list-modules` subparser nor a `list_modules` handler that prints modul...
the test calls `ret = cli.main(['list-modules'], stdout, stderr)` and asserts `stderr.getvalue() == ""`, `stdout.getvalue() == "tests.test_cli\n"` (and `"\n"` in the no-modules test), and `ret == 0`.
with no `list-modules` choice registered on the subparsers object, `parser.parse_args(['list-modules'])` treats it as an invalid choice, so argparse writes a usage/error message to `sys.stderr` and raises `SystemExit(2)` before any handler runs. `cli.main` never returns 0 and `stdout` stays empty, so `assert stdout.get...
tests/test_cli.py::test_display_list_of_modules
### `list-modules` subcommand and its handler were never re-added to the CLI parser - **Input condition**: `code`: the diff to `monkeytype/cli.py` only inserts `args.config = get_monkeytype_config(args.config)`; `main()` still registers only the other subparsers (e.g. `stub_parser` … `stub_parser.set_defaults(handler=p...
stb1000r1__Instagram__MonkeyType.70c3acf6.pr_61__spec__list-modules--subcommand-and-its-handler-we__dd36a1ebd204.md
Instagram__MonkeyType.70c3acf6.pr_61
Instagram/MonkeyType
swe-smith
swe_1000
1,000
a41cb39313ab
c8c7152e6a81d670
Space-suppression check applied to the n>1 branch instead of only n==1 With grams ending in `' '`, the `n >= 2` branch hits `if ch == ' ': return` and yields `None`, so `assertEqual(ngram.get(2), 'A ')` fails with `None != 'A '` (and the same for `get(3)`). The trailing-space suppression must apply only when `n == 1`; ...
- Space-suppression check applied to the n>1 branch instead of only n==1 With grams ending in `' '`, the `n >= 2` branch hits `if ch == ' ': return` and yields `None`, so `assertEqual(ngram.get(2), 'A ')` fails with `None != 'A '` (and the same for `get(3)`). The trailing-space suppression must apply only when `n =...
perf_spec
a named unit test will fail
Space-suppression check applied to the n>1 branch instead of only n==1
`code`: `NGram.get`'s `else` branch (for `n >= 2`) reads `ch = self.grams[-1]` and does `if ch == ' ': return` before returning `self.grams[-n:]`.
In `test_ngram3`, after `ngram.add_char('A')` and `ngram.add_char('1')` (normalized to `' '`), the test asserts `self.assertEqual(ngram.get(2), 'A ')` and `self.assertEqual(ngram.get(3), ' A ')`. Likewise in `test_ngram`, after `ngram.add_char(six.u('\u2010'))` (normalized to a space) it asserts `ngram.get(2) == six.u(...
With grams ending in `' '`, the `n >= 2` branch hits `if ch == ' ': return` and yields `None`, so `assertEqual(ngram.get(2), 'A ')` fails with `None != 'A '` (and the same for `get(3)`). The trailing-space suppression must apply only when `n == 1`; multi-character grams ending in space must still be returned.
langdetect/tests/utils/test_ngram.py::NGramTest::test_ngram3
### Space-suppression check applied to the n>1 branch instead of only n==1 - **Input condition**: `code`: `NGram.get`'s `else` branch (for `n >= 2`) reads `ch = self.grams[-1]` and does `if ch == ' ': return` before returning `self.grams[-n:]`. - **Code requirement**: In `test_ngram3`, after `ngram.add_char('A')` and `...
stb1000r1__Mimino666__langdetect.a1598f1a.func_pm_ctrl_invert_if__up9qazlk__spec__space-suppression-check-applied-to-the-n-1-b__a41cb39313ab.md
Mimino666__langdetect.a1598f1a.func_pm_ctrl_invert_if__up9qazlk
Mimino666/langdetect
swe-smith
swe_1000
1,000
ee06bbef235c
e6a518cf58eb04ab
`NumpyReader.get_data` passes a single ndarray through `ensure_tuple`, which iterates the array's first axis instead of treating it as one image `ensure_tuple` only wraps non-iterable values; an `np.ndarray` is iterable, so `ensure_tuple(arr)` yields a 3-tuple of `(4, 4)` sub-arrays. The loop therefore sets `header["sp...
- `NumpyReader.get_data` passes a single ndarray through `ensure_tuple`, which iterates the array's first axis instead of treating it as one image `ensure_tuple` only wraps non-iterable values; an `np.ndarray` is iterable, so `ensure_tuple(arr)` yields a 3-tuple of `(4, 4)` sub-arrays. The loop therefore sets `head...
perf_spec
a named unit test will fail
`NumpyReader.get_data` passes a single ndarray through `ensure_tuple`, which iterates the array's first axis instead of treating it as one image
`code`: `NumpyReader.get_data(self, img)` loops with `for i in ensure_tuple(img):`, where `img` is whatever `read()` returned — for a single `.npy` file that is the bare `np.ndarray` (`return img_ if len(img_) > 1 else img_[0]`).
`reader.get_data(reader.read(filepath))` on a file saved from `np.random.randint(0, 256, size=[3, 4, 4])` must satisfy `self.assertTupleEqual(result[1]["spatial_shape"], test_data.shape)` i.e. `(3, 4, 4)`, and `self.assertTupleEqual(result[0].shape, test_data.shape)`. The same applies to `test_npz1`; `test_npy_pickle` ...
`ensure_tuple` only wraps non-iterable values; an `np.ndarray` is iterable, so `ensure_tuple(arr)` yields a 3-tuple of `(4, 4)` sub-arrays. The loop therefore sets `header["spatial_shape"] = (4, 4)` and `assertTupleEqual((4, 4), (3, 4, 4))` fails in `test_npy`/`test_npz1`. For the pickled-dict cases the loaded object i...
tests/test_numpy_reader.py::TestNumpyReader::test_npy
### `NumpyReader.get_data` passes a single ndarray through `ensure_tuple`, which iterates the array's first axis instead of treating it as one image - **Input condition**: `code`: `NumpyReader.get_data(self, img)` loops with `for i in ensure_tuple(img):`, where `img` is whatever `read()` returned — for a single `.npy` ...
stb1000r1__Project-MONAI__MONAI-1030__spec__numpyreader-get-data--passes-a-single-ndarr__ee06bbef235c.md
Project-MONAI__MONAI-1030
Project-MONAI/MONAI
swe-gym
swe_1000
1,000
013f89f2155a
e7cfbe0261a58c24
NumpyReader.read discards all but the first array of a multi-array .npz because it returns based on filename count Only one filename is passed, so `len(filenames) > 1` is False and `read` returns `img_[0]` — just `arr_0`/`test1` — throwing away the second array. `get_data` then wraps that single ndarray in `img_list = ...
- NumpyReader.read discards all but the first array of a multi-array .npz because it returns based on filename count Only one filename is passed, so `len(filenames) > 1` is False and `read` returns `img_[0]` — just `arr_0`/`test1` — throwing away the second array. `get_data` then wraps that single ndarray in `img_l...
perf_spec
a named unit test will fail
NumpyReader.read discards all but the first array of a multi-array .npz because it returns based on filename count
`code`: `NumpyReader.read` builds `img_: List[Any]`, appends one entry per `npz_keys`/`arr_i` inside an `.npz`, then ends with `return img_ if len(filenames) > 1 else img_[0]`.
The test calls `reader.get_data(reader.read(filepath))` on a single file written with `np.savez(filepath, test_data1, test_data2)` (two 3x4x4 arrays) and asserts `self.assertTupleEqual(result[0].shape, (2, 3, 4, 4))` and `np.testing.assert_allclose(result[0], np.stack([test_data1, test_data2]))`; the same holds for `te...
Only one filename is passed, so `len(filenames) > 1` is False and `read` returns `img_[0]` — just `arr_0`/`test1` — throwing away the second array. `get_data` then wraps that single ndarray in `img_list = [img]`, stacks nothing, and returns an array of shape `(3, 4, 4)`, so `assertTupleEqual(result[0].shape, (2, 3, 4, ...
tests/test_numpy_reader.py::TestNumpyReader::test_npz2
### NumpyReader.read discards all but the first array of a multi-array .npz because it returns based on filename count - **Input condition**: `code`: `NumpyReader.read` builds `img_: List[Any]`, appends one entry per `npz_keys`/`arr_i` inside an `.npz`, then ends with `return img_ if len(filenames) > 1 else img_[0]`. -...
stb1000r1__Project-MONAI__MONAI-1030__spec__numpyreader-read-discards-all-but-the-first__013f89f2155a.md
Project-MONAI__MONAI-1030
Project-MONAI/MONAI
swe-gym
swe_1000
1,000
812e20ee78b6
084d27833f25f29a
`read()` was never given a `**kwargs` override, so per-call reader options raise TypeError because `read()` has no `**kwargs` parameter, `reader.read(filepath, mmap_mode=None)` raises `TypeError: read() got an unexpected keyword argument 'mmap_mode'` before `get_data` is ever reached, so the assertion never executes an...
- `read()` was never given a `**kwargs` override, so per-call reader options raise TypeError because `read()` has no `**kwargs` parameter, `reader.read(filepath, mmap_mode=None)` raises `TypeError: read() got an unexpected keyword argument 'mmap_mode'` before `get_data` is ever reached, so the assertion never execu...
perf_spec
a named unit test will fail
`read()` was never given a `**kwargs` override, so per-call reader options raise TypeError
`code`: the diff only changes `get_data()` signatures; every `read()` (`ITKReader.read`, `NibabelReader.read`, `NumpyReader.read`, `PILReader.read`) keeps its original signature that accepts only `data` (plus fixed positional args) and uses `self.kwargs` stored at construction time.
the test constructs `reader = NumpyReader(mmap_mode="r")` and then calls `reader.get_data(reader.read(filepath, mmap_mode=None))[0].item()`, i.e. `read()` must accept a keyword argument that overrides the constructor kwarg for that single call, and the returned object must satisfy `result["test"].shape == test_data["te...
because `read()` has no `**kwargs` parameter, `reader.read(filepath, mmap_mode=None)` raises `TypeError: read() got an unexpected keyword argument 'mmap_mode'` before `get_data` is ever reached, so the assertion never executes and the test errors
tests/test_numpy_reader.py::TestNumpyReader::test_kwargs
### `read()` was never given a `**kwargs` override, so per-call reader options raise TypeError - **Input condition**: `code`: the diff only changes `get_data()` signatures; every `read()` (`ITKReader.read`, `NibabelReader.read`, `NumpyReader.read`, `PILReader.read`) keeps its original signature that accepts only `data`...
stb1000r1__Project-MONAI__MONAI-1030__spec__read----was-never-given-a----kwargs--overri__812e20ee78b6.md
Project-MONAI__MONAI-1030
Project-MONAI/MONAI
swe-gym
swe_1000
1,000
5baf5c428bd5
1e70bf17d0abfa81
One-hot conversion of the target is ignored by the gather branch, which still tests the original `target` because `to_onehot_y=True`, `t` becomes shape `(1, 2, 4, 4)` with values 0/1, yet `target.shape[1] == 1` is still True, so the code executes `logpt.gather(1, t.long())` using the one-hot *values* as channel indices...
- One-hot conversion of the target is ignored by the gather branch, which still tests the original `target` because `to_onehot_y=True`, `t` becomes shape `(1, 2, 4, 4)` with values 0/1, yet `target.shape[1] == 1` is still True, so the code executes `logpt.gather(1, t.long())` using the one-hot *values* as channel i...
perf_spec
a named unit test will fail
One-hot conversion of the target is ignored by the gather branch, which still tests the original `target`
`code`: `forward` builds `t = one_hot(t, num_classes=n_pred_ch)` when `self.to_onehot_y` is set, but the subsequent class-selection branch is written as `if target.shape[1] == 1:` and gathers with `logpt.gather(1, t.long())`, i.e. it inspects the untouched `target` argument rather than the converted `t`.
the test constructs `loss = FocalLoss(to_onehot_y=True)`, `target = target.unsqueeze(1)` of shape `(1, 1, 4, 4)` and `pred_very_good = 1000 * F.one_hot(target, num_classes=2).permute(0, 3, 1, 2).float()`, then asserts `self.assertAlmostEqual(focal_loss_good, 0.0, places=3)` for `float(loss(pred_very_good, target).cpu()...
because `to_onehot_y=True`, `t` becomes shape `(1, 2, 4, 4)` with values 0/1, yet `target.shape[1] == 1` is still True, so the code executes `logpt.gather(1, t.long())` using the one-hot *values* as channel indices. For a voxel of class 0 the one-hot vector is `[1, 0]`, so the gather returns `[logpt[1], logpt[0]]` — i....
tests/test_focal_loss.py::TestFocalLoss::test_bin_seg_2d
### One-hot conversion of the target is ignored by the gather branch, which still tests the original `target` - **Input condition**: `code`: `forward` builds `t = one_hot(t, num_classes=n_pred_ch)` when `self.to_onehot_y` is set, but the subsequent class-selection branch is written as `if target.shape[1] == 1:` and gat...
stb1000r1__Project-MONAI__MONAI-1765__spec__one-hot-conversion-of-the-target-is-ignored__5baf5c428bd5.md
Project-MONAI__MONAI-1765
Project-MONAI/MONAI
swe-gym
swe_1000
1,000
d0bae8de88c3
77cb831f8520ea64
ZipDataset/Dataset `__getitem__` never gained slice support; only CacheDataset was touched passing the list `[1, 3, 4]` reaches the sub-datasets' integer-index path unchanged (base `Dataset.__getitem__` does `self.data[index]`, `Dataset_` returns `index`), so no 3-element subset object is created; the call errors or re...
- ZipDataset/Dataset `__getitem__` never gained slice support; only CacheDataset was touched passing the list `[1, 3, 4]` reaches the sub-datasets' integer-index path unchanged (base `Dataset.__getitem__` does `self.data[index]`, `Dataset_` returns `index`), so no 3-element subset object is created; the call errors...
perf_spec
a named unit test will fail
ZipDataset/Dataset `__getitem__` never gained slice support; only CacheDataset was touched
`code`: the only new index handling is in `CacheDataset.__getitem__`, covering `slice` and `numbers.Integral`; nothing anywhere handles a `Sequence` of indices, and `ZipDataset.__getitem__` is untouched.
the test requires `subset = test_dataset[[1, 3, 4]]` on a `ZipDataset` of three `Dataset_(5)` to give `len(subset) == 3` and `subset[-1] == (4, 4, 4)`.
passing the list `[1, 3, 4]` reaches the sub-datasets' integer-index path unchanged (base `Dataset.__getitem__` does `self.data[index]`, `Dataset_` returns `index`), so no 3-element subset object is created; the call errors or returns the list itself per dataset, and both `len(subset) == 3` and `subset[-1] == (4, 4, 4)...
tests/test_zipdataset.py::TestZipDataset::test_slicing
### ZipDataset/Dataset `__getitem__` never gained slice support; only CacheDataset was touched - **Input condition**: `code`: the diff modifies only `CacheDataset.__getitem__` in `monai/data/dataset.py`, adding a `isinstance(index, slice)` branch that calls `super().__getitem__(index)`; `Dataset.__getitem__` and `ZipDa...
stb1000r1__Project-MONAI__MONAI-1885__spec__zipdataset-dataset----getitem----never-gaine__d0bae8de88c3.md
Project-MONAI__MONAI-1885
Project-MONAI/MONAI
swe-gym
swe_1000
1,000
ba71009e90ee
96c4e8f185b1481f
`separate_folder` added after `patch_index` in `create_file_basename`, so positional callers swap the two With the submitted signature the 5th positional arg binds to `patch_index=False` and the 6th to `separate_folder=5`. Since `5` is truthy the function still joins the `test` subfolder, and since `patch_index` is `Fa...
- `separate_folder` added after `patch_index` in `create_file_basename`, so positional callers swap the two With the submitted signature the 5th positional arg binds to `patch_index=False` and the 6th to `separate_folder=5`. Since `5` is truthy the function still joins the `test` subfolder, and since `patch_index` ...
perf_spec
a named unit test will fail
`separate_folder` added after `patch_index` in `create_file_basename`, so positional callers swap the two
`code`: `monai/data/utils.py` defines `create_file_basename(postfix, input_file_name, folder_path, data_root_dir="", patch_index=None, separate_folder=True)`, i.e. the new `separate_folder` flag is appended as the 6th parameter, after `patch_index`.
The test calls `create_file_basename("", "test.txt", output_tmp, "foo", False, 5)` and asserts the result equals `os.path.join(output_tmp, "test_5")`; it also calls `create_file_basename("post", "test.tar.gz", output_tmp, "foo", True, 8)` expecting `os.path.join(output_tmp, "test", "test_post_8")`. So the 5th positiona...
With the submitted signature the 5th positional arg binds to `patch_index=False` and the 6th to `separate_folder=5`. Since `5` is truthy the function still joins the `test` subfolder, and since `patch_index` is `False` (not `None`) it appends `f"_{False}"`. The first of these calls therefore returns `output_tmp/test/te...
tests/test_file_basename.py::TestFilename::test_value
### `separate_folder` added after `patch_index` in `create_file_basename`, so positional callers swap the two - **Input condition**: `code`: `monai/data/utils.py` defines `create_file_basename(postfix, input_file_name, folder_path, data_root_dir="", patch_index=None, separate_folder=True)`, i.e. the new `separate_folde...
stb1000r1__Project-MONAI__MONAI-2576__spec__separate-folder--added-after--patch-index__ba71009e90ee.md
Project-MONAI__MONAI-2576
Project-MONAI/MONAI
swe-gym
swe_1000
1,000
1313bcd57651
ede0e5fa3265fba1
EnsureType was never given a `device` parameter; only ToTensord was changed passing `device="cpu"` to `EnsureTyped` raises `TypeError: __init__() got an unexpected keyword argument 'device'`, so the transform is never constructed and none of the assertions run; the parameter is also not plumbed through to the wrapped `...
- EnsureType was never given a `device` parameter; only ToTensord was changed passing `device="cpu"` to `EnsureTyped` raises `TypeError: __init__() got an unexpected keyword argument 'device'`, so the transform is never constructed and none of the assertions run; the parameter is also not plumbed through to the wra...
perf_spec
a named unit test will fail
EnsureType was never given a `device` parameter; only ToTensord was changed
`code`: `EnsureTyped.__init__` in `monai/transforms/utility/dictionary.py` is unmodified by the diff (signature `(keys, data_type="tensor", dtype=None, allow_missing_keys=False)`), and it builds `EnsureType(data_type=data_type)` with no device.
the test calls `EnsureTyped(keys="data", data_type=dtype, device="cpu")({"data": test_data})["data"]` and asserts `isinstance(result, dict)` and `isinstance(result["img"], torch.Tensor if dtype == "tensor" else np.ndarray)`.
passing `device="cpu"` to `EnsureTyped` raises `TypeError: __init__() got an unexpected keyword argument 'device'`, so the transform is never constructed and none of the assertions run; the parameter is also not plumbed through to the wrapped `EnsureType`/`ToTensor`.
tests/test_ensure_type.py::TestEnsureType::test_single_input
### EnsureType was never given a `device` parameter; only ToTensord was changed - **Input condition**: `code`: the diff touches only `monai/transforms/utility/dictionary.py::ToTensord.__init__`, adding `device` there; `EnsureType.__init__` in `monai/transforms/utility/array.py` still has only `data_type` (and `dtype`) ...
stb1000r1__Project-MONAI__MONAI-2942__spec__ensuretype-was-never-given-a--device--parame__1313bcd57651.md
Project-MONAI__MONAI-2942
Project-MONAI/MONAI
swe-gym
swe_1000
1,000
4cbc1f8559a8
8771861f3a7cf21b
`dtype` was only added to `ScaleIntensityRange`, not propagated to `ScaleIntensityRangePercentiles`, and its default is `None` instead of `float32` because `dtype` defaults to `None`, `__call__` skips the `convert_data_type` branch entirely, and `ScaleIntensityRangePercentiles` never forwards a `dtype` to the inner `Sc...
- `dtype` was only added to `ScaleIntensityRange`, not propagated to `ScaleIntensityRangePercentiles`, and its default is `None` instead of `float32` because `dtype` defaults to `None`, `__call__` skips the `convert_data_type` branch entirely, and `ScaleIntensityRangePercentiles` never forwards a `dtype` to the inn...
perf_spec
a named unit test will fail
`dtype` was only added to `ScaleIntensityRange`, not propagated to `ScaleIntensityRangePercentiles`, and its default is `None` instead of `float32`
`code`: the diff touches only `ScaleIntensityRange.__init__`/`__call__`, adding `dtype: Optional[DtypeLike] = None`; `ScaleIntensityRangePercentiles` (which builds a `ScaleIntensityRange` internally) is unchanged and passes no `dtype`.
`test_scaling` instantiates the percentile transform and compares its output against an expected array of the transform's declared output dtype (`np.float32`) — i.e. the scaled result must come back converted to the default output dtype rather than in the input's dtype.
because `dtype` defaults to `None`, `__call__` skips the `convert_data_type` branch entirely, and `ScaleIntensityRangePercentiles` never forwards a `dtype` to the inner `ScaleIntensityRange` (it has no such parameter), so the returned array keeps the dtype produced by the arithmetic (e.g. `float64` for a numpy int/floa...
tests/test_scale_intensity_range_percentiles.py::TestScaleIntensityRangePercentiles::test_scaling
### `dtype` was only added to `ScaleIntensityRange`, not propagated to `ScaleIntensityRangePercentiles`, and its default is `None` instead of `float32` - **Input condition**: `code`: the diff touches only `ScaleIntensityRange.__init__`/`__call__`, adding `dtype: Optional[DtypeLike] = None`; `ScaleIntensityRangePercenti...
stb1000r1__Project-MONAI__MONAI-3235__spec__dtype--was-only-added-to--scaleintensityran__4cbc1f8559a8.md
Project-MONAI__MONAI-3235
Project-MONAI/MONAI
swe-gym
swe_1000
1,000
4f59fbebfd2c
a3f2ca84d432ef45
`make_animated_gif_summary` still returns a single `Summary` proto instead of an iterable of them because the function returns one `Summary` protobuf message, `for s in summary_object_np` iterates a non-iterable protobuf message (or, if iteration is permitted, yields field/value pairs rather than `Summary` objects), so...
- `make_animated_gif_summary` still returns a single `Summary` proto instead of an iterable of them because the function returns one `Summary` protobuf message, `for s in summary_object_np` iterates a non-iterable protobuf message (or, if iteration is permitted, yields field/value pairs rather than `Summary` object...
perf_spec
a named unit test will fail
`make_animated_gif_summary` still returns a single `Summary` proto instead of an iterable of them
`code`: the diff only adds `_image3_animated_gif_rgb` and a branch inside `plot_2d_or_3d_image`; `make_animated_gif_summary` in `monai/visualize/img2tensorboard.py` is left untouched, still ending in a `return` of one `Summary(...)` (built from `_image3_animated_gif`) rather than a list/generator of summaries.
the test calls `summary_object_np = make_animated_gif_summary(tag="test_summary_nparr.png", image=nparr, max_out=1, animation_axes=(3,), image_axes=(1, 2), scale_factor=253.0)` with `nparr = np.ones(shape=(1, 32, 32, 32), dtype=np.float32)` and then does `for s in summary_object_np: assert isinstance(s, tensorboard.com...
because the function returns one `Summary` protobuf message, `for s in summary_object_np` iterates a non-iterable protobuf message (or, if iteration is permitted, yields field/value pairs rather than `Summary` objects), so the loop raises `TypeError`/the `isinstance(s, ...Summary)` assertion fails before the tensor bra...
tests/test_img2tensorboard.py::TestImg2Tensorboard::test_write_gray
### `make_animated_gif_summary` still returns a single `Summary` proto instead of an iterable of them - **Input condition**: `code`: the diff only adds `_image3_animated_gif_rgb` and a branch inside `plot_2d_or_3d_image`; `make_animated_gif_summary` in `monai/visualize/img2tensorboard.py` is left untouched, still endin...
stb1000r1__Project-MONAI__MONAI-3250__spec__make-animated-gif-summary--still-returns-a__4f59fbebfd2c.md
Project-MONAI__MONAI-3250
Project-MONAI/MONAI
swe-gym
swe_1000
1,000
2e00113ec698
9e71325eabfaac2b
`rescale_array` was never updated to accept `minv`/`maxv` of `None`, so the new "or" branch in `ScaleIntensity` passes `None` into arithmetic with `minv=0.0, maxv=None` the relaxed condition is now true, so `ScaleIntensity` calls `rescale_array(img, 0.0, None, dtype=...)`; inside `rescale_array` the unchanged line `(no...
- `rescale_array` was never updated to accept `minv`/`maxv` of `None`, so the new "or" branch in `ScaleIntensity` passes `None` into arithmetic with `minv=0.0, maxv=None` the relaxed condition is now true, so `ScaleIntensity` calls `rescale_array(img, 0.0, None, dtype=...)`; inside `rescale_array` the unchanged lin...
perf_spec
a named unit test will fail
`rescale_array` was never updated to accept `minv`/`maxv` of `None`, so the new "or" branch in `ScaleIntensity` passes `None` into arithmetic
`code`: the diff only relaxes `ScaleIntensity.__call__`'s guard from `if self.minv is not None and self.maxv is not None:` to `if self.minv is not None or self.maxv is not None:`, and makes no change to `monai/transforms/utils.py::rescale_array`, which still computes `norm * (maxv - minv) + minv` unconditionally.
the test builds `scaler = ScaleIntensity(minv=0.0, maxv=None, factor=0.1)`, calls `result = scaler(p(self.imt))`, computes `expected = rescale_array(p(self.imt), minv=0.0, maxv=None)` and requires `assert_allclose(result, expected, rtol=1e-3, atol=1e-3)`; i.e. both `ScaleIntensity` with one of `minv`/`maxv` set to `Non...
with `minv=0.0, maxv=None` the relaxed condition is now true, so `ScaleIntensity` calls `rescale_array(img, 0.0, None, dtype=...)`; inside `rescale_array` the unchanged line `(norm * (maxv - minv)) + minv` evaluates `None - 0.0`, raising `TypeError: unsupported operand type(s) for -: 'NoneType' and 'float'`. The same e...
tests/test_scale_intensity.py::TestScaleIntensity::test_max_none
### `rescale_array` was never updated to accept `minv`/`maxv` of `None`, so the new "or" branch in `ScaleIntensity` passes `None` into arithmetic - **Input condition**: `code`: the diff only relaxes `ScaleIntensity.__call__`'s guard from `if self.minv is not None and self.maxv is not None:` to `if self.minv is not None...
stb1000r1__Project-MONAI__MONAI-3277__spec__rescale-array--was-never-updated-to-accept__2e00113ec698.md
Project-MONAI__MONAI-3277
Project-MONAI/MONAI
swe-gym
swe_1000
1,000
a94d9bef70bf
42db9ce364f40336
`SegResNet.__init__` never validates `spatial_dims`, so no `ValueError` is raised for 4-D input with `spatial_dims=4`, construction proceeds into `get_conv_layer(...)`/`Convolution`, whose `Conv[Conv.CONV, 4]` factory lookup indexes the 3-element `(nn.Conv1d, nn.Conv2d, nn.Conv3d)` table and raises a non-`ValueError` e...
- `SegResNet.__init__` never validates `spatial_dims`, so no `ValueError` is raised for 4-D input with `spatial_dims=4`, construction proceeds into `get_conv_layer(...)`/`Convolution`, whose `Conv[Conv.CONV, 4]` factory lookup indexes the 3-element `(nn.Conv1d, nn.Conv2d, nn.Conv3d)` table and raises a non-`ValueEr...
perf_spec
a named unit test will fail
`SegResNet.__init__` never validates `spatial_dims`, so no `ValueError` is raised for 4-D input
`code`: the diff only threads an `act` parameter through `ResBlock`/`SegResNet`; `SegResNet.__init__` (and `_make_down_layers`/`_make_up_layers`) contain no check on `spatial_dims`, e.g. no `if spatial_dims not in (1, 2, 3): raise ValueError(...)`.
the test does `with self.assertRaises(ValueError): SegResNet(spatial_dims=4)` — constructing `SegResNet` with `spatial_dims=4` must raise `ValueError` during `__init__`.
with `spatial_dims=4`, construction proceeds into `get_conv_layer(...)`/`Convolution`, whose `Conv[Conv.CONV, 4]` factory lookup indexes the 3-element `(nn.Conv1d, nn.Conv2d, nn.Conv3d)` table and raises a non-`ValueError` exception (IndexError/KeyError-style factory error) — or, where group-norm and factory lookups ha...
tests/test_segresnet.py::TestResNet::test_ill_arg
### `SegResNet.__init__` never validates `spatial_dims`, so no `ValueError` is raised for 4-D input - **Input condition**: `code`: the diff only threads an `act` parameter through `ResBlock`/`SegResNet`; `SegResNet.__init__` (and `_make_down_layers`/`_make_up_layers`) contain no check on `spatial_dims`, e.g. no `if spa...
stb1000r1__Project-MONAI__MONAI-3419__spec__segresnet---init----never-validates--spatia__a94d9bef70bf.md
Project-MONAI__MONAI-3419
Project-MONAI/MONAI
swe-gym
swe_1000
1,000
b8f676657aa0
9d6ed3b6c36334b1
The metric module itself was never updated; only the handler was rewritten to consume an API that does not exist yet Because no line of `monai/metrics/meandice.py` changed, the per-class value/NaN semantics the tests assert are still the old ones, so all four cases fail identically to before the patch. The handler's ne...
- The metric module itself was never updated; only the handler was rewritten to consume an API that does not exist yet Because no line of `monai/metrics/meandice.py` changed, the per-class value/NaN semantics the tests assert are still the old ones, so all four cases fail identically to before the patch. The handle...
perf_spec
a named unit test will fail
The metric module itself was never updated; only the handler was rewritten to consume an API that does not exist yet
`code`: the diff touches only `monai/handlers/mean_dice.py`; `monai/metrics/meandice.py` (the `compute_meandice` function and the `DiceMetric` class) is left exactly as it was before the task.
The failing tests live in `tests/test_compute_meandice.py::TestComputeMeanDice` and exercise `compute_meandice`/`DiceMetric` directly (the `test_value_class_*` and `test_nans_class_*` parameterized cases), asserting per-class dice values and the NaN/`not_nans` behaviour of the metric object — nothing in these tests imp...
Because no line of `monai/metrics/meandice.py` changed, the per-class value/NaN semantics the tests assert are still the old ones, so all four cases fail identically to before the patch. The handler's new `DiceMetric(..., reduction="mean")` usage and its read of `self.dice.not_nans` cannot influence these tests at all;...
tests/test_compute_meandice.py::TestComputeMeanDice::test_value_class_0
### The metric module itself was never updated; only the handler was rewritten to consume an API that does not exist yet - **Input condition**: `code`: the diff touches only `monai/handlers/mean_dice.py`; `monai/metrics/meandice.py` (the `compute_meandice` function and the `DiceMetric` class) is left exactly as it was ...
stb1000r1__Project-MONAI__MONAI-600__spec__the-metric-module-itself-was-never-updated__b8f676657aa0.md
Project-MONAI__MONAI-600
Project-MONAI/MONAI
swe-gym
swe_1000
1,000
ad905c373184
ada16e91676b3ed6
Only the Sphinx theme config was changed; no metric code was touched `docs/source/conf.py` is not imported by the test suite and has no effect on `monai.metrics`; the dice computation executes exactly the same code path and returns exactly the same values as before the patch, so whatever mismatch (wrong shape or `nan` ...
- Only the Sphinx theme config was changed; no metric code was touched `docs/source/conf.py` is not imported by the test suite and has no effect on `monai.metrics`; the dice computation executes exactly the same code path and returns exactly the same values as before the patch, so whatever mismatch (wrong shape or ...
perf_spec
a named unit test will fail
Only the Sphinx theme config was changed; no metric code was touched
`code`: the entire submitted diff consists of one added line, `"navigation_with_keys": False,` inside `html_theme_options` in `docs/source/conf.py`; no file under `monai/metrics/` (e.g. `meandice.py`, `DiceHelper`, `compute_dice`) and no file under `tests/` is added or modified.
the parameterized cases `test_nans_class_5/6/7` in `tests/test_compute_meandice.py` are generated from the `TEST_CASE_*` entries feeding `test_nans_class`, which call `monai.metrics` dice computation (`compute_dice`/`DiceHelper`/`DiceMetric`) with a class-count argument (`num_classes`) and assert the returned per-class...
`docs/source/conf.py` is not imported by the test suite and has no effect on `monai.metrics`; the dice computation executes exactly the same code path and returns exactly the same values as before the patch, so whatever mismatch (wrong shape or `nan` vs. numeric per-class score) made these three cases fail is reproduce...
tests/test_compute_meandice.py::TestComputeMeanDice::test_nans_class_5
### Only the Sphinx theme config was changed; no metric code was touched - **Input condition**: `code`: the entire submitted diff consists of one added line, `"navigation_with_keys": False,` inside `html_theme_options` in `docs/source/conf.py`; no file under `monai/metrics/` (e.g. `meandice.py`, `DiceHelper`, `compute_...
stb1000r1__Project-MONAI__MONAI-7163__spec__only-the-sphinx-theme-config-was-changed--no__ad905c373184.md
Project-MONAI__MONAI-7163
Project-MONAI/MONAI
swe-gym
swe_1000
1,000
701ad89b3551
f02815d96a97c15d
Rewritten `find_offset` treats the logical-line mapping as `(start, end)` spans and returns an index, not a `(row, column)` position Unpacking `(start, end)` from a mapping entry gives `start = 0` (the int offset) and `end = (1, 0)` (the position tuple), so the guard evaluates `0 <= 0` (true) and then `0 < (1, 0)`, rai...
- Rewritten `find_offset` treats the logical-line mapping as `(start, end)` spans and returns an index, not a `(row, column)` position Unpacking `(start, end)` from a mapping entry gives `start = 0` (the int offset) and `end = (1, 0)` (the position tuple), so the guard evaluates `0 <= 0` (true) and then `0 < (1, 0)...
perf_spec
a named unit test will fail
Rewritten `find_offset` treats the logical-line mapping as `(start, end)` spans and returns an index, not a `(row, column)` position
`code`: `checker.py` defines `find_offset(offset, mapping)` as a loop `for i, (start, end) in enumerate(mapping): if start <= offset < end: return i, offset - start`, with a fallback `return 0, 0`, and no `if isinstance(offset, tuple): return offset` shortcut. The mapping it receives is `processor._LogicalMapping`, i.e...
The test registers the local plugin `yields_logical_line`, which yields `0, f"T001 {logical_line!r}"` for the source `f'hello world'`, and asserts `main(("t.py", "--config", str(cfg))) == 1` with output exactly `t.py:1:1: T001 "f'xxxxxxxxxxx'"` — i.e. offset `0` must be mapped to row 1, column 0 (reported as `1:1`).
Unpacking `(start, end)` from a mapping entry gives `start = 0` (the int offset) and `end = (1, 0)` (the position tuple), so the guard evaluates `0 <= 0` (true) and then `0 < (1, 0)`, raising `TypeError: '<' not supported between instances of 'int' and 'tuple'`; the plugin's result is therefore discarded/not reported. ...
tests/integration/test_plugins.py::test_logical_line_plugin
### Rewritten `find_offset` treats the logical-line mapping as `(start, end)` spans and returns an index, not a `(row, column)` position - **Input condition**: `code`: `checker.py` defines `find_offset(offset, mapping)` as a loop `for i, (start, end) in enumerate(mapping): if start <= offset < end: return i, offset - s...
stb1000r1__PyCQA__flake8.cf1542ce.func_pm_class_rm_funcs__5v5w0noe__spec__rewritten--find-offset--treats-the-logical-l__701ad89b3551.md
PyCQA__flake8.cf1542ce.func_pm_class_rm_funcs__5v5w0noe
PyCQA/flake8
swe-smith
swe_1000
1,000
606cee35f4f6
f0dcdcee43315544
Check dispatch uses plugin/processor attribute names that do not exist, so no physical or logical checks ever run every invocation of `run_physical_checks` immediately raises `AttributeError: 'Checkers' object has no attribute 'physical_line_plugins'` (and likewise for the logical/ast variants and `processor.logical_li...
- Check dispatch uses plugin/processor attribute names that do not exist, so no physical or logical checks ever run every invocation of `run_physical_checks` immediately raises `AttributeError: 'Checkers' object has no attribute 'physical_line_plugins'` (and likewise for the logical/ast variants and `processor.logi...
perf_spec
a named unit test will fail
Check dispatch uses plugin/processor attribute names that do not exist, so no physical or logical checks ever run
`code`: `FileChecker.run_physical_checks` iterates `self.plugins.physical_line_plugins`, `run_logical_checks` iterates `self.plugins.logical_line_plugins` and `self.processor.logical_lines`, and `run_ast_checks` iterates `self.plugins.ast_plugins`, while the `Checkers` container actually exposes `tree`, `logical_line`,...
the test writes `t_py_src = "def f():\n\tpass"`, asserts `cli.main(["t.py"]) == 1` and that stdout equals exactly `"t.py:2:1: W191 indentation contains tabs\nt.py:2:6: W292 no newline at end of file\n"` — i.e. pycodestyle's physical-line checks (`tabs_or_spaces` → W191, `trailing_blank_lines` → W292) must actually be i...
every invocation of `run_physical_checks` immediately raises `AttributeError: 'Checkers' object has no attribute 'physical_line_plugins'` (and likewise for the logical/ast variants and `processor.logical_lines`), so no W191/W292 result is ever produced. The file is reported with no violations (or a generic internal err...
tests/integration/test_main.py::test_physical_line_file_not_ending_in_newline
### Check dispatch uses plugin/processor attribute names that do not exist, so no physical or logical checks ever run - **Input condition**: `code`: `FileChecker.run_physical_checks` iterates `self.plugins.physical_line_plugins`, `run_logical_checks` iterates `self.plugins.logical_line_plugins` and `self.processor.logi...
stb1000r1__PyCQA__flake8.cf1542ce.lm_rewrite__1olwk6um__spec__check-dispatch-uses-plugin-processor-attribu__606cee35f4f6.md
PyCQA__flake8.cf1542ce.lm_rewrite__1olwk6um
PyCQA/flake8
swe-smith
swe_1000
1,000
2f8a28f31f7a
a726beb160816114
Fix confined to `walk_keys`; `flip` keeps its own key/value defect
- Fix confined to `walk_keys`; `flip` keeps its own key/value defect
perf_spec
a named unit test will fail
Fix confined to `walk_keys`; `flip` keeps its own key/value defect
`code`: the diff edits only `funcy/colls.py::walk_keys` (its `pair_f` and its return line); `flip`
tests/test_colls.py::test_flip
### Fix confined to `walk_keys`; `flip` keeps its own key/value defect - **Input condition**: `code`: the diff edits only `funcy/colls.py::walk_keys` (its `pair_f` and its return line); `flip`
stb1000r1__Suor__funcy.207a7810.combine_file__b3usvi20__spec__fix-confined-to--walk-keys----flip--keeps-it__2f8a28f31f7a.md
Suor__funcy.207a7810.combine_file__b3usvi20
Suor/funcy
swe-smith
swe_1000
1,000
72c49a6e4f3a
7cdf43dceeeea4f9
`disable`/`enable` directives slice the comment at the wrong offset, so rule names are never parsed and every rule is toggled `'# yamllint disable'` is 18 characters, so in `'# yamllint disable rule:trailing-spaces'` the substring `comment[23:]` is `':trailing-spaces'` (the offset 23 is copied from the longer `disable-...
- `disable`/`enable` directives slice the comment at the wrong offset, so rule names are never parsed and every rule is toggled `'# yamllint disable'` is 18 characters, so in `'# yamllint disable rule:trailing-spaces'` the substring `comment[23:]` is `':trailing-spaces'` (the offset 23 is copied from the longer `di...
perf_spec
a named unit test will fail
`disable`/`enable` directives slice the comment at the wrong offset, so rule names are never parsed and every rule is toggled
`code`: `process_comment` handles `# yamllint disable ...` with `items = comment[23:].rstrip().split(' ')` and `# yamllint enable ...` with `items = comment[22:].rstrip().split(' ')`, then keeps only `item.startswith('rule:')`.
For the input `'---\n- [valid , YAML]\n# yamllint disable rule:trailing-spaces\n- trailing spaces \n- bad : colon\n- [valid , YAML]\n# yamllint enable rule:trailing-spaces\n- bad : colon and spaces \n- [valid , YAML]\n'`, the test asserts exactly three problems: `problem1=(5, 8, 'colons')`, `problem2=(8, 7, 'colons')`,...
`'# yamllint disable'` is 18 characters, so in `'# yamllint disable rule:trailing-spaces'` the substring `comment[23:]` is `':trailing-spaces'` (the offset 23 is copied from the longer `disable-line` prefix). No item starts with `'rule:'`, so `rules_to_disable` is empty and the branch executes `self.rules = self.all_ru...
tests/test_yamllint_directives.py::YamllintDirectivesTestCase::test_disable_directive_with_rules
### `disable`/`enable` directives slice the comment at the wrong offset, so rule names are never parsed and every rule is toggled - **Input condition**: `code`: `process_comment` handles `# yamllint disable ...` with `items = comment[23:].rstrip().split(' ')` and `# yamllint enable ...` with `items = comment[22:].rstr...
stb1000r1__adrienverge__yamllint.8513d9b9.func_pm_remove_cond__iiywe9cj__spec__disable---enable--directives-slice-the-comm__72c49a6e4f3a.md
adrienverge__yamllint.8513d9b9.func_pm_remove_cond__iiywe9cj
adrienverge/yamllint
swe-smith
swe_1000
1,000
8ec18657e161
8771354e9d9ee2f3
The reversal was only removed from the `exceptions` property while `self._exceptions` is still populated in reversed order Because the stored `_exceptions` is still reversed, `eg.exceptions` yields `(ValueError(2), TypeError(int), ValueError(1))`. `eg.exceptions[0]` is ValueError(2), whose `__cause__` is `None`, so `as...
- The reversal was only removed from the `exceptions` property while `self._exceptions` is still populated in reversed order Because the stored `_exceptions` is still reversed, `eg.exceptions` yields `(ValueError(2), TypeError(int), ValueError(1))`. `eg.exceptions[0]` is ValueError(2), whose `__cause__` is `None`, ...
perf_spec
a named unit test will fail
The reversal was only removed from the `exceptions` property while `self._exceptions` is still populated in reversed order
`code`: `BaseExceptionGroup.exceptions` now returns `tuple(self._exceptions)` unchanged, but the place that assigns `self._exceptions` (the `__new__`/`__init__` construction path, and correspondingly `derive`/`split`) still stores the constructor's `excs` sequence back-to-front, so the sub-exception tuple is still the ...
`create_simple_eg()` builds `excs = [ValueError(1) (raised `from` MemoryError), TypeError(int) (context OSError), ValueError(2) (context ImportError)]` and raises `ExceptionGroup("simple eg", excs)`. The test then requires `self.assertIsInstance(eg.exceptions[0].__cause__, MemoryError)`, `self.assertIsInstance(eg.excep...
Because the stored `_exceptions` is still reversed, `eg.exceptions` yields `(ValueError(2), TypeError(int), ValueError(1))`. `eg.exceptions[0]` is ValueError(2), whose `__cause__` is `None`, so `assertIsInstance(eg.exceptions[0].__cause__, MemoryError)` fails (and, were it reached, `eg.exceptions[0].__traceback__.tb_li...
tests/test_exceptions.py::ExceptionGroupFields::test_basics_ExceptionGroup_fields
### The reversal was only removed from the `exceptions` property while `self._exceptions` is still populated in reversed order - **Input condition**: `code`: `BaseExceptionGroup.exceptions` now returns `tuple(self._exceptions)` unchanged, but the place that assigns `self._exceptions` (the `__new__`/`__init__` construct...
stb1000r1__agronholm__exceptiongroup.0b4f4937.combine_file__74zzufuj__spec__the-reversal-was-only-removed-from-the--exce__8ec18657e161.md
agronholm__exceptiongroup.0b4f4937.combine_file__74zzufuj
agronholm/exceptiongroup
swe-smith
swe_1000
1,000
48e061a5651b
0cb853d619f1717c
Async-handler rejection uses the wrong message and is raised inside the handler's own try/except, so it surfaces as an ExceptionGroup instead of a TypeError Two independent mismatches. (1) The raised message is `handler <function delegate...> is async, but async handlers are not supported`, which does not match the req...
- Async-handler rejection uses the wrong message and is raised inside the handler's own try/except, so it surfaces as an ExceptionGroup instead of a TypeError Two independent mismatches. (1) The raised message is `handler <function delegate...> is async, but async handlers are not supported`, which does not match t...
perf_spec
a named unit test will fail
Async-handler rejection uses the wrong message and is raised inside the handler's own try/except, so it surfaces as an ExceptionGroup instead of a TypeError
`code`: `_Catcher.__exit__` calls `result = handler(matched)` inside `try:` and, when `inspect.iscoroutine(result)`, raises `TypeError(f"handler {handler!r} is async, but async handlers are not supported")` from within that same `try` block whose `except BaseException as new_exc:` appends to `new_exceptions`.
The test does `with pytest.raises(TypeError, match="Exception handler must be a sync function.")` around `with catch({TypeError: delegate}): raise ExceptionGroup("message", [TypeError("uh-oh")])`, where `delegate` returns a coroutine. So the escaping exception must be a plain `TypeError` whose message matches the liter...
Two independent mismatches. (1) The raised message is `handler <function delegate...> is async, but async handlers are not supported`, which does not match the required `match="Exception handler must be a sync function."` regex. (2) The `raise TypeError(...)` occurs inside the `try` guarded by `except BaseException as ...
tests/test_catch.py::test_async_handler
### Async-handler rejection uses the wrong message and is raised inside the handler's own try/except, so it surfaces as an ExceptionGroup instead of a TypeError - **Input condition**: `code`: `_Catcher.__exit__` calls `result = handler(matched)` inside `try:` and, when `inspect.iscoroutine(result)`, raises `TypeError(f...
stb1000r1__agronholm__exceptiongroup.0b4f4937.pr_69__spec__async-handler-rejection-uses-the-wrong-messa__48e061a5651b.md
agronholm__exceptiongroup.0b4f4937.pr_69
agronholm/exceptiongroup
swe-smith
swe_1000
1,000
59a2283ba168
56243e281b6b2639
`qualified_name` applies the "class " prefix to instances, not only to classes
- `qualified_name` applies the "class " prefix to instances, not only to classes
perf_spec
a named unit test will fail
`qualified_name` applies the "class " prefix to instances, not only to classes
`code`: `qualified_name` in `src/typeguard/_utils.py` computes `name` and then unconditionally does `if add_class_prefix: name = "class " + name`, outside of the `inspect.isclass(obj)` branch (the per-branch `prefix` variable was removed).
The test calls `check_type(TestMapping.DummyMapping
tests/test_checkers.py::TestDict::test_bad_key_type
### `qualified_name` applies the "class " prefix to instances, not only to classes - **Input condition**: `code`: `qualified_name` in `src/typeguard/_utils.py` computes `name` and then unconditionally does `if add_class_prefix: name = "class " + name`, outside of the `inspect.isclass(obj)` branch (the per-branch `prefi...
stb1000r1__agronholm__typeguard.b6a7e438.combine_file__guqsm0lk__spec__qualified-name--applies-the--class---prefix__59a2283ba168.md
agronholm__typeguard.b6a7e438.combine_file__guqsm0lk
agronholm/typeguard
swe-smith
swe_1000
1,000
e6cde49bdcea
593047601de64049
pytest_configure parses every typeguard option but only writes `forward_ref_policy` back into `global_config` The parsed `debug_instrumentation`, `typecheck_fail_callback` and `collection_check_strategy` values are computed into locals and then discarded — they are never stored on `global_config` — so the fresh `TypeCh...
- pytest_configure parses every typeguard option but only writes `forward_ref_policy` back into `global_config` The parsed `debug_instrumentation`, `typecheck_fail_callback` and `collection_check_strategy` values are computed into locals and then discarded — they are never stored on `global_config` — so the fresh `...
perf_spec
a named unit test will fail
pytest_configure parses every typeguard option but only writes `forward_ref_policy` back into `global_config`
`code`: `pytest_configure` in `src/typeguard/_pytest_plugin.py`, where each option is read via `getoption(...)`/`getini(...)` into a local variable, and the only assignment onto the module-level `global_config` object is the added line `global_config.forward_ref_policy = forward_ref_policy`.
With `pyproject.toml` containing `typeguard-debug-instrumentation = true`, `typeguard-typecheck-fail-callback = "mypackage:failcallback"`, `typeguard-forward-ref-policy = "ERROR"` and `typeguard-collection-check-strategy = "ALL_ITEMS"`, after `pytester.parseconfigure()` the test asserts on the `TypeCheckConfiguration()...
The parsed `debug_instrumentation`, `typecheck_fail_callback` and `collection_check_strategy` values are computed into locals and then discarded — they are never stored on `global_config` — so the fresh `TypeCheckConfiguration()` supplied by the fixture keeps its defaults (`typecheck_fail_callback is None`, `debug_inst...
tests/test_pytest_plugin.py::test_config_options
### pytest_configure parses every typeguard option but only writes `forward_ref_policy` back into `global_config` - **Input condition**: `code`: `pytest_configure` in `src/typeguard/_pytest_plugin.py`, where each option is read via `getoption(...)`/`getini(...)` into a local variable, and the only assignment onto the m...
stb1000r1__agronholm__typeguard.b6a7e438.combine_module__jb2cb66p__spec__pytest-configure-parses-every-typeguard-opti__e6cde49bdcea.md
agronholm__typeguard.b6a7e438.combine_module__jb2cb66p
agronholm/typeguard
swe-smith
swe_1000
1,000
a4dc8e46a21c
945742d76fc1253c
The `config` object exported from the `typeguard` package is not the same instance the instrumentation code reads setting `debug_instrumentation` on `typeguard.config` leaves the `global_config` instance actually consulted by the source-loader with `debug_instrumentation is False`, so nothing is written to stderr; `cap...
- The `config` object exported from the `typeguard` package is not the same instance the instrumentation code reads setting `debug_instrumentation` on `typeguard.config` leaves the `global_config` instance actually consulted by the source-loader with `debug_instrumentation is False`, so nothing is written to stderr...
perf_spec
a named unit test will fail
The `config` object exported from the `typeguard` package is not the same instance the instrumentation code reads
`code`: the diff only edits `src/typeguard/_pytest_plugin.py`; the global configuration object in `_config.py` / `typeguard/__init__.py` is left as submitted, so `typeguard.config` (the name the tests patch) and the `global_config` consulted by the import hook / `TypeguardTransformer` driver are separate objects (or `c...
the test does `monkeypatch.setattr("typeguard.config.debug_instrumentation", True)` and then `import_dummymodule()`, and asserts `f"Source code of {path_str!r} after instrumentation:" in err` and `"class DummyClass" in err`; i.e. the code path in `_importhook.py` that prints the unparsed instrumented source must test t...
setting `debug_instrumentation` on `typeguard.config` leaves the `global_config` instance actually consulted by the source-loader with `debug_instrumentation is False`, so nothing is written to stderr; `capsys.readouterr()` returns an empty `err` and the `in err` assertion fails. By the same mechanism the callback assi...
tests/test_importhook.py::test_debug_instrumentation
### The `config` object exported from the `typeguard` package is not the same instance the instrumentation code reads - **Input condition**: `code`: the diff only edits `src/typeguard/_pytest_plugin.py`; the global configuration object in `_config.py` / `typeguard/__init__.py` is left as submitted, so `typeguard.config...
stb1000r1__agronholm__typeguard.b6a7e438.combine_module__jb2cb66p__spec__the--config--object-exported-from-the--typeg__a4dc8e46a21c.md
agronholm__typeguard.b6a7e438.combine_module__jb2cb66p
agronholm/typeguard
swe-smith
swe_1000
1,000
ebbab174fd61
9748d02bd9517030
Argument path element omits the "class " prefix for class values (`add_class_prefix=False`) the passed value is the class `int`, and `qualified_name(int, add_class_prefix=False)` returns `"int"` without the `class ` prefix (the prefix is only emitted when `add_class_prefix=True` and the value is a type). The appended p...
- Argument path element omits the "class " prefix for class values (`add_class_prefix=False`) the passed value is the class `int`, and `qualified_name(int, add_class_prefix=False)` returns `"int"` without the `class ` prefix (the prefix is only emitted when `add_class_prefix=True` and the value is a type). The appe...
perf_spec
a named unit test will fail
Argument path element omits the "class " prefix for class values (`add_class_prefix=False`)
`code`: in `check_argument_types` (src/typeguard/_functions.py), the `except TypeCheckError` handler builds the path element with `qualname = qualified_name(value, add_class_prefix=False)` and then `exc.append_path_element(f'argument "{argname}" ({qualname})')`.
the test calls `Foo().method(int)` where `method(cls, subclass: type[Self])`, and requires the raised `TypeCheckError` message to match the regex `rf'argument "subclass" \(class int\) is not a subclass of the self type \({__name__}\....Foo\)'` — i.e. the parenthesised description of the failing argument must be literal...
the passed value is the class `int`, and `qualified_name(int, add_class_prefix=False)` returns `"int"` without the `class ` prefix (the prefix is only emitted when `add_class_prefix=True` and the value is a type). The appended path element is therefore `argument "subclass" (int)`, so the message reads `... argument "su...
tests/test_typechecked.py::TestSelf::test_self_type_invalid
### Argument path element omits the "class " prefix for class values (`add_class_prefix=False`) - **Input condition**: `code`: in `check_argument_types` (src/typeguard/_functions.py), the `except TypeCheckError` handler builds the path element with `qualname = qualified_name(value, add_class_prefix=False)` and then `e...
stb1000r1__agronholm__typeguard.b6a7e438.func_basic__1vy7d8i5__spec__argument-path-element-omits-the--class---pre__ebbab174fd61.md
agronholm__typeguard.b6a7e438.func_basic__1vy7d8i5
agronholm/typeguard
swe-smith
swe_1000
1,000
7b0292ee3ba3
8da55d1121fe93d5
visit_Module never inserts the collected typeguard imports into the module body The visitor rewrites the assignment and references `TypeCheckMemo`/`check_variable_assignment`, and records the needed imports in the module `TransformMemo`, but since those recorded import nodes are never spliced into `node.body`, `unparse...
- visit_Module never inserts the collected typeguard imports into the module body The visitor rewrites the assignment and references `TypeCheckMemo`/`check_variable_assignment`, and records the needed imports in the module `TransformMemo`, but since those recorded import nodes are never spliced into `node.body`, `u...
perf_spec
a named unit test will fail
visit_Module never inserts the collected typeguard imports into the module body
`code`: `TypeguardTransformer.visit_Module` runs `self.generic_visit(node)`, then `fix_missing_locations(node)` and returns `node`, without ever calling the module memo's import-insertion step (`self._memo.insert_imports(node)` / equivalent) that prepends the `Import`/`ImportFrom` nodes recorded while visiting the func...
The test does `TypeguardTransformer().visit(node)` on a module containing `def foo() -> None: x: int = otherfunc()` and asserts `unparse(node)` equals a string whose first two lines are `from typeguard import TypeCheckMemo` and `from typeguard._functions import check_variable_assignment`, followed by the function with ...
The visitor rewrites the assignment and references `TypeCheckMemo`/`check_variable_assignment`, and records the needed imports in the module `TransformMemo`, but since those recorded import nodes are never spliced into `node.body`, `unparse(node)` begins directly with `def foo() -> None:` and lacks the two `from ... im...
tests/test_transformer.py::TestAssign::test_annotated_assign
### visit_Module never inserts the collected typeguard imports into the module body - **Input condition**: `code`: `TypeguardTransformer.visit_Module` runs `self.generic_visit(node)`, then `fix_missing_locations(node)` and returns `node`, without ever calling the module memo's import-insertion step (`self._memo.insert_...
stb1000r1__agronholm__typeguard.b6a7e438.func_basic__2ccm2li6__spec__visit-module-never-inserts-the-collected-typ__7b0292ee3ba3.md
agronholm__typeguard.b6a7e438.func_basic__2ccm2li6
agronholm/typeguard
swe-smith
swe_1000
1,000
47317e05d3ea
b324954ef92461b0
NotIn's error message omits "not" and is gated behind `self.msg and ...`, so the raised NotInInvalid text never matches The f-string says "value must be one of", missing the word "not", so even when it is used the message reads `value must be one of ['blue', 'red', 'yellow'] ...` and `pytest.raises(..., match=...)` fai...
- NotIn's error message omits "not" and is gated behind `self.msg and ...`, so the raised NotInInvalid text never matches The f-string says "value must be one of", missing the word "not", so even when it is used the message reads `value must be one of ['blue', 'red', 'yellow'] ...` and `pytest.raises(..., match=......
perf_spec
a named unit test will fail
NotIn's error message omits "not" and is gated behind `self.msg and ...`, so the raised NotInInvalid text never matches
`code`: `NotIn.__call__` raises `NotInInvalid(self.msg and f'value must be one of {sorted(self.container, key=str)}')` when the value *is* found in the container; only the trailing `return None` was changed to `return v`.
`schema({"color": "blue"})` with `NotIn(frozenset(["red","blue","yellow"]))` must raise a `MultipleInvalid` whose string matches `r"value must not be one of \['blue', 'red', 'yellow'\] for dictionary value @ data\['color'\]"`.
The f-string says "value must be one of", missing the word "not", so even when it is used the message reads `value must be one of ['blue', 'red', 'yellow'] ...` and `pytest.raises(..., match=...)` fails. Worse, `self.msg` defaults to `None`, so `self.msg and f'...'` evaluates to `None` and `NotInInvalid` falls back to ...
voluptuous/tests/tests.py::test_not_in
### NotIn's error message omits "not" and is gated behind `self.msg and ...`, so the raised NotInInvalid text never matches - **Input condition**: `code`: `NotIn.__call__` raises `NotInInvalid(self.msg and f'value must be one of {sorted(self.container, key=str)}')` when the value *is* found in the container; only the t...
stb1000r1__alecthomas__voluptuous.a7a55f83.func_basic__dmvdztbd__spec__notin-s-error-message-omits--not--and-is-gat__47317e05d3ea.md
alecthomas__voluptuous.a7a55f83.func_basic__dmvdztbd
alecthomas/voluptuous
swe-smith
swe_1000
1,000
341ff43bef4a
b215e11235063f0f
`split()` only right-strips each statement, so leading newlines from the previous statement's separator remain The statement splitter emits the newline that follows `select foo;` as part of the *next* statement, so `stack.run` yields `'select foo;'` and `'\nselect bar;\n'`. `rstrip()` removes only the trailing newline,...
- `split()` only right-strips each statement, so leading newlines from the previous statement's separator remain The statement splitter emits the newline that follows `select foo;` as part of the *next* statement, so `stack.run` yields `'select foo;'` and `'\nselect bar;\n'`. `rstrip()` removes only the trailing ne...
perf_spec
a named unit test will fail
`split()` only right-strips each statement, so leading newlines from the previous statement's separator remain
`code`: `sqlparse.split()` returns `[str(stmt).rstrip() for stmt in stack.run(sql, encoding)]`, applying `rstrip()` (right-side only) rather than a full `strip()` to each statement produced by the filter stack.
For `sqlparse.split('select foo;\nselect bar;\n')` the test asserts `len(stmts) == 2`, `stmts[0] == 'select foo;'` and, crucially, `stmts[1] == 'select bar;'` — i.e. the second statement must contain no leading whitespace.
The statement splitter emits the newline that follows `select foo;` as part of the *next* statement, so `stack.run` yields `'select foo;'` and `'\nselect bar;\n'`. `rstrip()` removes only the trailing newline, leaving `'\nselect bar;'`, so the assertion `stmts[1] == 'select bar;'` fails (a leading `\n` is present). The...
tests/test_split.py::test_split_ignores_empty_newlines
### `split()` only right-strips each statement, so leading newlines from the previous statement's separator remain - **Input condition**: `code`: `sqlparse.split()` returns `[str(stmt).rstrip() for stmt in stack.run(sql, encoding)]`, applying `rstrip()` (right-side only) rather than a full `strip()` to each statement p...
stb1000r1__andialbrecht__sqlparse.e57923b3.func_basic__6536ejmm__spec__split----only-right-strips-each-statement__341ff43bef4a.md
andialbrecht__sqlparse.e57923b3.func_basic__6536ejmm
andialbrecht/sqlparse
swe-smith
swe_1000
1,000
ad89fd6389c0
bbe303248daa5387
`_stripws_parenthesis` returns early instead of collapsing whitespace inside the parentheses `_stripws_default` is what rewrites each interior whitespace token to a single `' '` (and drops duplicates); because `_stripws_parenthesis` returns before calling it, the newline-plus-indent token between `ROWS` and `BETWEEN` (...
- `_stripws_parenthesis` returns early instead of collapsing whitespace inside the parentheses `_stripws_default` is what rewrites each interior whitespace token to a single `' '` (and drops duplicates); because `_stripws_parenthesis` returns before calling it, the newline-plus-indent token between `ROWS` and `BETW...
perf_spec
a named unit test will fail
`_stripws_parenthesis` returns early instead of collapsing whitespace inside the parentheses
`code`: `StripWhitespaceFilter._stripws_parenthesis` in `sqlparse/filters/others.py` only pops leading whitespace (index 1) and whitespace before the closing paren (index -2), then ends with `return None`; it never delegates to `self._stripws_default(tlist)` for the tokens *between* the parens.
The test feeds SQL whose parenthesised groups contain embedded newlines/indentation — `SUM(a) OVER (PARTITION BY b ORDER BY c ROWS\n BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)` — and asserts the formatter output line is exactly `' SUM(a) OVER (PARTITION BY b ORDER BY c ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW...
`_stripws_default` is what rewrites each interior whitespace token to a single `' '` (and drops duplicates); because `_stripws_parenthesis` returns before calling it, the newline-plus-indent token between `ROWS` and `BETWEEN` (and similarly inside the `(PARTITION BY b, c ORDER BY d DESC)` group) survives unchanged into...
tests/test_format.py::TestFormatReindentAligned::test_window_functions
### `_stripws_parenthesis` returns early instead of collapsing whitespace inside the parentheses - **Input condition**: `code`: `StripWhitespaceFilter._stripws_parenthesis` in `sqlparse/filters/others.py` only pops leading whitespace (index 1) and whitespace before the closing paren (index -2), then ends with `return N...
stb1000r1__andialbrecht__sqlparse.e57923b3.func_basic__y1wdfz19__spec__stripws-parenthesis--returns-early-instead__ad89fd6389c0.md
andialbrecht__sqlparse.e57923b3.func_basic__y1wdfz19
andialbrecht/sqlparse
swe-smith
swe_1000
1,000
d7f069e0a4de
27834269b1f55568
Reverse branch starts at `start - 1`, so `token_prev` returns the token at the caller's own index (off-by-one) `token_prev(idx)` pre-increments to `idx+1`, so the first index scanned must be `(idx+1) - 2 == idx - 1`; with `start - 1` the scan begins at `idx` itself, so `token_prev` returns the *current* token (e.g. the...
- Reverse branch starts at `start - 1`, so `token_prev` returns the token at the caller's own index (off-by-one) `token_prev(idx)` pre-increments to `idx+1`, so the first index scanned must be `(idx+1) - 2 == idx - 1`; with `start - 1` the scan begins at `idx` itself, so `token_prev` returns the *current* token (e....
perf_spec
a named unit test will fail
Reverse branch starts at `start - 1`, so `token_prev` returns the token at the caller's own index (off-by-one)
`code`: in `TokenList._token_matching`, the `if reverse:` branch sets `indexes = range(start - 1, -1, -1)` instead of `range(start - 2, -1, -1)`, while `token_next`/`token_prev` still do `idx += 1` before delegating to `_token_matching(funcs, idx, reverse=_reverse)`.
`sqlparse.format('select *-- statement starts here\nfrom foo', strip_comments=True)` must equal `'select *\nfrom foo'` (and likewise `'select-- foo\nfrom -- bar\nwhere'` → `'select\nfrom\nwhere'`, `'--comment\nselect a-- statement starts here\nfrom foo--comment\nf'` → `'select a\nfrom foo\nf'`).
`token_prev(idx)` pre-increments to `idx+1`, so the first index scanned must be `(idx+1) - 2 == idx - 1`; with `start - 1` the scan begins at `idx` itself, so `token_prev` returns the *current* token (e.g. the Comment being removed) instead of its predecessor. `StripCommentsFilter._process` inspects the previous/next t...
tests/test_format.py::TestFormat::test_strip_comments_single
### Reverse branch starts at `start - 1`, so `token_prev` returns the token at the caller's own index (off-by-one) - **Input condition**: `code`: in `TokenList._token_matching`, the `if reverse:` branch sets `indexes = range(start - 1, -1, -1)` instead of `range(start - 2, -1, -1)`, while `token_next`/`token_prev` stil...
stb1000r1__andialbrecht__sqlparse.e57923b3.func_pm_remove_assign__ggze24wp__spec__reverse-branch-starts-at--start---1---so--to__d7f069e0a4de.md
andialbrecht__sqlparse.e57923b3.func_pm_remove_assign__ggze24wp
andialbrecht/sqlparse
swe-smith
swe_1000
1,000
c9504914a6ae
3a0eba66c4828aaf
`_generate_pattern_re` no longer returns the compiled regex/token pair A Python function that falls off the end returns `None`, so `_generate_pattern_re("MMM D YYYY H:mmA")` yields `None` and the tuple unpacking in `parse` raises `TypeError: cannot unpack non-sequence NoneType` (or `TypeError: cannot unpack non-iterabl...
- `_generate_pattern_re` no longer returns the compiled regex/token pair A Python function that falls off the end returns `None`, so `_generate_pattern_re("MMM D YYYY H:mmA")` yields `None` and the tuple unpacking in `parse` raises `TypeError: cannot unpack non-sequence NoneType` (or `TypeError: cannot unpack non-i...
perf_spec
a named unit test will fail
`_generate_pattern_re` no longer returns the compiled regex/token pair
`code`: in `arrow/parser.py`, `DateTimeParser._generate_pattern_re` builds `bounded_fmt_pattern` and then the method body ends — the final statement `return tokens, re.compile(bounded_fmt_pattern, flags=re.IGNORECASE)` was deleted by the diff (the next line is the `@overload` decorator of `_parse_token`).
The test calls `self.factory.get("Jun 1 2005 1:33PM", "MMM D YYYY H:mmA", tzinfo=tz.tzutc(), normalize_whitespace=True)` and asserts `result._datetime == datetime(2005, 6, 1, 13, 33, tzinfo=tz.tzutc())`, then calls `self.factory.get("\t 2013-05-05T12:30:45.123456 \t \n", tzinfo=tz.tzutc(), normalize_whitespace=True)` a...
A Python function that falls off the end returns `None`, so `_generate_pattern_re("MMM D YYYY H:mmA")` yields `None` and the tuple unpacking in `parse` raises `TypeError: cannot unpack non-sequence NoneType` (or `TypeError: cannot unpack non-iterable NoneType object`) before any datetime is produced. No `Arrow` object ...
tests/test_factory.py::TestGet::test_kwarg_normalize_whitespace
### `_generate_pattern_re` no longer returns the compiled regex/token pair - **Input condition**: `code`: in `arrow/parser.py`, `DateTimeParser._generate_pattern_re` builds `bounded_fmt_pattern` and then the method body ends — the final statement `return tokens, re.compile(bounded_fmt_pattern, flags=re.IGNORECASE)` was...
stb1000r1__arrow-py__arrow.1d70d009.func_basic__6mvezcqs__spec__generate-pattern-re--no-longer-returns-the__c9504914a6ae.md
arrow-py__arrow.1d70d009.func_basic__6mvezcqs
arrow-py/arrow
swe-smith
swe_1000
1,000
821880f63060
ee1548998c48dbbe
Locale registry entries are left unfixed: at least one registered locale name violates the lowercase `^[a-z]{2}(-[a-z]{2})?(?:-latn|-cyrl)?$` shape
- Locale registry entries are left unfixed: at least one registered locale name violates the lowercase `^[a-z]{2}(-[a-z]{2})?(?:-latn|-cyrl)?$` shape
perf_spec
a named unit test will fail
Locale registry entries are left unfixed: at least one registered locale name violates the lowercase `^[a-z]{2}(-[a-z]{2})?(?:-latn|-cyrl)?$` shape
`code`: the submission modifies only `arrow/parser.py` (`_generate_pattern_re`); `arrow/locales.py` and every `Locale` subclass's `names` list are unchanged, and the test fixture enumerates every locale class in that registry via `self.locales.values()`.
For **every** `locale_cls` in the registry and **every** entry of `locale_cls.names`, the test asserts `assert locale_name.islower()` and `assert re.match(r"^[a-z]{2}(-[a-z]{2})?(?:-latn|-cyrl)?$", locale_name)` — i.e. each name must be all‑lowercase and either `xx`, `xx-yy`, or such a name suffixed with `-latn`/`-cyrl...
tests/test_locales.py::TestLocaleValidation::test_locale_name_validation
### Locale registry entries are left unfixed: at least one registered locale name violates the lowercase `^[a-z]{2}(-[a-z]{2})?(?:-latn|-cyrl)?$` shape - **Input condition**: `code`: the submission modifies only `arrow/parser.py` (`_generate_pattern_re`); `arrow/locales.py` and every `Locale` subclass's `names` list ar...
stb1000r1__arrow-py__arrow.1d70d009.func_basic__6mvezcqs__spec__locale-registry-entries-are-left-unfixed--at__821880f63060.md
arrow-py__arrow.1d70d009.func_basic__6mvezcqs
arrow-py/arrow
swe-smith
swe_1000
1,000
c6f931f4adcd
c82c315e02d7161f
Locale definitions left untouched: a `Locale` subclass in `arrow/locales.py` still declares a `names` entry that violates the required lowercase language-tag form At least one locale class in `arrow/locales.py` carries a `names` entry outside that grammar (e.g. an uppercase region tag such as `"en-US"`, or a tag with m...
- Locale definitions left untouched: a `Locale` subclass in `arrow/locales.py` still declares a `names` entry that violates the required lowercase language-tag form At least one locale class in `arrow/locales.py` carries a `names` entry outside that grammar (e.g. an uppercase region tag such as `"en-US"`, or a tag ...
perf_spec
a named unit test will fail
Locale definitions left untouched: a `Locale` subclass in `arrow/locales.py` still declares a `names` entry that violates the required lowercase language-tag form
`code`: the submission edits only `Arrow.interval()` in `arrow/arrow.py` (the `for _ in range(interval)` → `range(interval - 1)` loop); `arrow/locales.py` is unchanged, so every class collected into `self.locales` (all `Locale` subclasses in the module) is whatever the repo already defines.
For **every** locale class and **every** string in its `names` list, the test requires `locale_name.islower()` to be true and `re.match(r"^[a-z]{2}(-[a-z]{2})?(?:-latn|-cyrl)?$", locale_name)` to be non-`None`; the companion test additionally requires `len(day_names) == 8`, `day_names[0] == ""`, `all(day_names[1:])`, `...
At least one locale class in `arrow/locales.py` carries a `names` entry outside that grammar (e.g. an uppercase region tag such as `"en-US"`, or a tag with more/other suffix segments than `-latn`/`-cyrl`), and that same class has malformed `day_names`/`month_names` tables (wrong length or an empty/`None` element), whic...
tests/test_locales.py::TestLocaleValidation::test_locale_name_validation
### Locale definitions left untouched: a `Locale` subclass in `arrow/locales.py` still declares a `names` entry that violates the required lowercase language-tag form - **Input condition**: `code`: the submission edits only `Arrow.interval()` in `arrow/arrow.py` (the `for _ in range(interval)` → `range(interval - 1)` l...
stb1000r1__arrow-py__arrow.1d70d009.func_basic__8t6qdo27__spec__locale-definitions-left-untouched--a--locale__c6f931f4adcd.md
arrow-py__arrow.1d70d009.func_basic__8t6qdo27
arrow-py/arrow
swe-smith
swe_1000
1,000
a90dede66d73
fd8d5dea7f6e0c69
Fix touches only SpanishLocale._ordinal_number, leaving the class-level locale tables that the validation loop walks unchanged none of these attributes are produced by `_ordinal_number`; the change alters only the ordinal suff
- Fix touches only SpanishLocale._ordinal_number, leaving the class-level locale tables that the validation loop walks unchanged none of these attributes are produced by `_ordinal_number`; the change alters only the ordinal suff
perf_spec
a named unit test will fail
Fix touches only SpanishLocale._ordinal_number, leaving the class-level locale tables that the validation loop walks unchanged
`code`: the submitted diff modifies exactly one line in `arrow/locales.py` — `SpanishLocale._ordinal_number` returning `f"{n}º"` instead of `f"{n}st"` — and adds/edits no class attributes (`names`, `day_names`, `day_abbreviations`, `month_names`, `month_abbreviations`, `past`, `future`) on any locale class.
the test loops `for locale_cls in self.locales.values():` over *every* registered locale class and requires, for each one, `len(locale_cls.day_names) == 8`, `locale_cls.day_names[0] == ""`, `all(locale_cls.day_names[1:])`, `len(locale_cls.day_abbreviations) == 8`, `locale_cls.day_abbreviations[0] == ""`, `all(locale_cl...
none of these attributes are produced by `_ordinal_number`; the change alters only the ordinal suff
tests/test_locales.py::TestLocaleValidation::test_locale_validation
### Fix touches only SpanishLocale._ordinal_number, leaving the class-level locale tables that the validation loop walks unchanged - **Input condition**: `code`: the submitted diff modifies exactly one line in `arrow/locales.py` — `SpanishLocale._ordinal_number` returning `f"{n}º"` instead of `f"{n}st"` — and adds/edit...
stb1000r1__arrow-py__arrow.1d70d009.func_basic__vjh7fi52__spec__fix-touches-only-spanishlocale--ordinal-numb__a90dede66d73.md
arrow-py__arrow.1d70d009.func_basic__vjh7fi52
arrow-py/arrow
swe-smith
swe_1000
1,000
2ee5e09a76fb
ae27ca0f8a1c8843
A Locale subclass left in arrow/locales.py has incomplete day/month name tables The edit region ends at `return form.format(delta)` and continues straight into the `class LevantArabicLocale(ArabicLocale):` block with its own `names`/`month_names` overrides; if that override list is not exactly 13 entries with `""` at i...
- A Locale subclass left in arrow/locales.py has incomplete day/month name tables The edit region ends at `return form.format(delta)` and continues straight into the `class LevantArabicLocale(ArabicLocale):` block with its own `names`/`month_names` overrides; if that override list is not exactly 13 entries with `""...
perf_spec
a named unit test will fail
A Locale subclass left in arrow/locales.py has incomplete day/month name tables
`code`: `arrow/locales.py` after the edit — the test collects every `Locale` subclass registered in the module (`self.locales`), including `ArabicLocale` and every class in the Arabic family that the patch touched (`LevantArabicLocale` and its siblings defined immediately after `_format_timeframe`).
For *every* registered locale class the test asserts `len(locale_cls.day_names) == 8`, `locale_cls.day_names[0] == ""`, `all(locale_cls.day_names[1:])`, `len(locale_cls.day_abbreviations) == 8`, `len(locale_cls.month_names) == 13`, `locale_cls.month_names[0] == ""`, `all(locale_cls.month_names[1:])`, `len(locale_cls.mo...
The edit region ends at `return form.format(delta)` and continues straight into the `class LevantArabicLocale(ArabicLocale):` block with its own `names`/`month_names` overrides; if that override list is not exactly 13 entries with `""` at index 0 (or any entry from index 1 on is blank/`None`), the very first `assert le...
tests/test_locales.py::TestLocaleValidation::test_locale_validation
### A Locale subclass left in arrow/locales.py has incomplete day/month name tables - **Input condition**: `code`: `arrow/locales.py` after the edit — the test collects every `Locale` subclass registered in the module (`self.locales`), including `ArabicLocale` and every class in the Arabic family that the patch touched...
stb1000r1__arrow-py__arrow.1d70d009.func_pm_ctrl_invert_if__mql22w2s__spec__a-locale-subclass-left-in-arrow-locales-py-h__2ee5e09a76fb.md
arrow-py__arrow.1d70d009.func_pm_ctrl_invert_if__mql22w2s
arrow-py/arrow
swe-smith
swe_1000
1,000
8655ad19fb27
edbf9ec95e4517c2
`_format_timeframe` output strings are never made to match the test's expected values; the only edit flips the `delta > 10` branch from `"ten"` to `"higher"` With `delta == 2` the `"hours"` entry resolves to the dual Arabic form, so the first assertion compares an Arabic string against `"2 ore"` and fails immediately; ...
- `_format_timeframe` output strings are never made to match the test's expected values; the only edit flips the `delta > 10` branch from `"ten"` to `"higher"` With `delta == 2` the `"hours"` entry resolves to the dual Arabic form, so the first assertion compares an Arabic string against `"2 ore"` and fails immedia...
perf_spec
a named unit test will fail
`_format_timeframe` output strings are never made to match the test's expected values; the only edit flips the `delta > 10` branch from `"ten"` to `"higher"`
`code`: `ArabicLocale._format_timeframe` still selects among the entries of `ArabicLocale.timeframes` (Arabic words such as `"ساعتين"`, `"{0} ساعات"`, `"{0} ساعة"`), and the submitted diff changes only the final `else:` branch (`delta > 10`) from `form = form["ten"]` to `form = form["higher"]`.
The test calls `self.locale._format_timeframe("hours", 2)` and asserts it equals `"2 ore"`, then `_format_timeframe("months", 2) == "2 luni"`, `_format_timeframe("days", 2) == "2 zile"`, `_format_timeframe("years", 2) == "2 ani"`, `_format_timeframe("hours", 3) == "3 ore"`, `_format_timeframe("months", 4) == "4 luni"`,...
With `delta == 2` the `"hours"` entry resolves to the dual Arabic form, so the first assertion compares an Arabic string against `"2 ore"` and fails immediately; no branch of the edited method can ever emit `"2 ore"`/`"3 ore"`/`"4 luni"` because those literals appear nowhere in `ArabicLocale.timeframes`. Additionally, ...
tests/test_locales.py::TestArabicLocale::test_timeframes
### `_format_timeframe` output strings are never made to match the test's expected values; the only edit flips the `delta > 10` branch from `"ten"` to `"higher"` - **Input condition**: `code`: `ArabicLocale._format_timeframe` still selects among the entries of `ArabicLocale.timeframes` (Arabic words such as `"ساعتين"`,...
stb1000r1__arrow-py__arrow.1d70d009.func_pm_ctrl_invert_if__mql22w2s__spec__format-timeframe--output-strings-are-never__8655ad19fb27.md
arrow-py__arrow.1d70d009.func_pm_ctrl_invert_if__mql22w2s
arrow-py/arrow
swe-smith
swe_1000
1,000
d548507936df
ed0f44b28fc97ef6
Locale classes in `arrow/locales.py` are left with incomplete `day_names`/`month_names` tables (unchanged by the patch) any registered locale class that still inherits the empty `Locale` defaults (or defines a list missing the leading `""` spacer, or containing an empty/`None` entry) will fail the very first length or ...
- Locale classes in `arrow/locales.py` are left with incomplete `day_names`/`month_names` tables (unchanged by the patch) any registered locale class that still inherits the empty `Locale` defaults (or defines a list missing the leading `""` spacer, or containing an empty/`None` entry) will fail the very first leng...
perf_spec
a named unit test will fail
Locale classes in `arrow/locales.py` are left with incomplete `day_names`/`month_names` tables (unchanged by the patch)
`code`: the submitted diff touches only `arrow/arrow.py` (the two `_SECS_PER_DAY`/`_SECS_PER_YEAR` comparisons); no locale class definition in `arrow/locales.py` is added, corrected, or padded.
the test iterates `for locale_cls in self.locales.values():` (every class registered in `locales._locale_map`) and requires, for each one, `len(locale_cls.day_names) == 8` with `day_names[0] == ""` and `all(locale_cls.day_names[1:])`, `len(locale_cls.day_abbreviations) == 8` with the same blank-first/all-truthy shape, ...
any registered locale class that still inherits the empty `Locale` defaults (or defines a list missing the leading `""` spacer, or containing an empty/`None` entry) will fail the very first length or truthiness assertion for that class; since the patch adds nothing to `arrow/locales.py`, such a class remains in `_local...
tests/test_locales.py::TestLocaleValidation::test_locale_validation
### Locale classes in `arrow/locales.py` are left with incomplete `day_names`/`month_names` tables (unchanged by the patch) - **Input condition**: `code`: the submitted diff touches only `arrow/arrow.py` (the two `_SECS_PER_DAY`/`_SECS_PER_YEAR` comparisons); no locale class definition in `arrow/locales.py` is added, c...
stb1000r1__arrow-py__arrow.1d70d009.func_pm_op_change_const__p8z4a47d__spec__locale-classes-in--arrow-locales-py--are-lef__d548507936df.md
arrow-py__arrow.1d70d009.func_pm_op_change_const__p8z4a47d
arrow-py/arrow
swe-smith
swe_1000
1,000
eda45ff629bd
0902990c8faf99c1
Locale class data left untouched: fix confined to formatter.py, so incomplete locale tables remain since the locale class definitions are byte-for-byte unchanged by this submission, any locale in the registry that has a short/blank `day_names`, `day_abbreviations`, `month_names` or `month_abbreviations` list, or a `Non...
- Locale class data left untouched: fix confined to formatter.py, so incomplete locale tables remain since the locale class definitions are byte-for-byte unchanged by this submission, any locale in the registry that has a short/blank `day_names`, `day_abbreviations`, `month_names` or `month_abbreviations` list, or ...
perf_spec
a named unit test will fail
Locale class data left untouched: fix confined to formatter.py, so incomplete locale tables remain
`code`: the submitted diff changes only `arrow/formatter.py` (the `SS`/`S` microsecond branches and a trailing newline); no file defining locale classes (`arrow/locales.py`) is modified.
the test iterates `for locale_cls in self.locales.values()` — i.e. every registered locale class — and requires for each one `len(locale_cls.day_names) == 8`, `locale_cls.day_names[0] == ""`, `all(locale_cls.day_names[1:])`, the same for `day_abbreviations`, `len(locale_cls.month_names) == 13`, `len(locale_cls.month_ab...
since the locale class definitions are byte-for-byte unchanged by this submission, any locale in the registry that has a short/blank `day_names`, `day_abbreviations`, `month_names` or `month_abbreviations` list, or a `None` `past`/`future`, still has it; the first such class encountered in the loop trips one of the `as...
tests/test_locales.py::TestLocaleValidation::test_locale_validation
### Locale class data left untouched: fix confined to formatter.py, so incomplete locale tables remain - **Input condition**: `code`: the submitted diff changes only `arrow/formatter.py` (the `SS`/`S` microsecond branches and a trailing newline); no file defining locale classes (`arrow/locales.py`) is modified. - **Cod...
stb1000r1__arrow-py__arrow.1d70d009.func_pm_op_swap__7t83cc2n__spec__locale-class-data-left-untouched--fix-confin__eda45ff629bd.md
arrow-py__arrow.1d70d009.func_pm_op_swap__7t83cc2n
arrow-py/arrow
swe-smith
swe_1000
1,000
f30a729c957f
06586fdc0be9f9a3
`shift()` passes an undefined `tzinfo` name to `fromdatetime`, raising NameError on every call Evaluating the keyword argument `tzinfo=tzinfo` looks up an unbound local name (`tzinfo` is neither a parameter of `shift` nor assigned anywhere in it), so `self.arrow.shift(minutes=1)` raises `NameError: name 'tzinfo' is not...
- `shift()` passes an undefined `tzinfo` name to `fromdatetime`, raising NameError on every call Evaluating the keyword argument `tzinfo=tzinfo` looks up an unbound local name (`tzinfo` is neither a parameter of `shift` nor assigned anywhere in it), so `self.arrow.shift(minutes=1)` raises `NameError: name 'tzinfo' ...
perf_spec
a named unit test will fail
`shift()` passes an undefined `tzinfo` name to `fromdatetime`, raising NameError on every call
`code`: `Arrow.shift()` ends with `return self.fromdatetime(current, tzinfo=tzinfo)`, but `shift`'s body only builds `relativedelta_kwargs`/`additional_attrs` from `**kwargs` and never binds a local `tzinfo` (unlike `replace()`, where `tzinfo = kwargs.pop("tzinfo", None)` is assigned before use).
The test's very first statement is `arrow_cmp = self.arrow.shift(minutes=1)`, and it then asserts `self.arrow < arrow_cmp` and `self.arrow < arrow_cmp.datetime`; `shift(minutes=1)` must return an Arrow one minute later.
Evaluating the keyword argument `tzinfo=tzinfo` looks up an unbound local name (`tzinfo` is neither a parameter of `shift` nor assigned anywhere in it), so `self.arrow.shift(minutes=1)` raises `NameError: name 'tzinfo' is not defined` before returning. The test errors out at the first line, never reaching the compariso...
tests/test_arrow.py::TestArrowComparison::test_gt
### `shift()` passes an undefined `tzinfo` name to `fromdatetime`, raising NameError on every call - **Input condition**: `code`: `Arrow.shift()` ends with `return self.fromdatetime(current, tzinfo=tzinfo)`, but `shift`'s body only builds `relativedelta_kwargs`/`additional_attrs` from `**kwargs` and never binds a local...
stb1000r1__arrow-py__arrow.1d70d009.func_pm_remove_cond__ui1q6qax__spec__shift----passes-an-undefined--tzinfo--name__f30a729c957f.md
arrow-py__arrow.1d70d009.func_pm_remove_cond__ui1q6qax
arrow-py/arrow
swe-smith
swe_1000
1,000
End of preview. Expand in Data Studio

SWE code-quality rubrics — 1006 distinct criteria (target 1000)

Falsifiable criteria about why a code change fails its tests, mined from agent attempts on real repositories. Each rubric makes one checkable prediction — a named unit test will fail, or a named exception will be raised — so it can be scored against an actual run instead of judged on taste.

This repo is one of three independent libraries collected to different sizes, for studying how a rubric database behaves with scale:

repo distinct criteria
swe-rubrics-10 15
swe-rubrics-100 227
swe-rubrics-1000 1006

They are not nested — each stage shuffled the task pool with its own seed, so the small library is not a subset of the large one.

Quick start (retrieval)

from datasets import load_dataset
from sentence_transformers import SentenceTransformer
import numpy as np

ds = load_dataset("EdwardoSunny/swe-rubrics-1000", split="train")
m  = SentenceTransformer("all-MiniLM-L6-v2")

# embed the field that exists for exactly this purpose
index = m.encode(ds["retrieval_text"], normalize_embeddings=True)

def top_k(issue_text, k=8):
    q = m.encode([issue_text], normalize_embeddings=True)[0]
    for i in np.argsort(-(index @ q))[:k]:
        yield ds[int(i)]

# and paste the pre-formatted block straight into a prompt
context = "\n".join(r["prompt_block"] for r in top_k(my_issue))

Two fields exist so you never have to reinvent them:

  • retrieval_text — embed or index this. Title + prediction only; the "input condition" / "code requirement" scaffolding is for judging whether a criterion applies and only dilutes the retrieval signal.
  • prompt_block — paste this. Already formatted for a model's context.

Contents

  • 1006 distinct criteria over 102 source repositories
  • families: {'perf_spec': 991, 'error_focused': 15}
  • mined from: {'swe-smith': 876, 'swe-gym': 130}

"Distinct" is post-deduplication: criteria were merged across tasks by an LLM adjudicator (with TF-IDF/embedding recall), so this is a count of surviving criteria rather than of curator calls.

Schema

field meaning
rubric_id stable id assigned at curation
criterion_sha256 hash of the prediction clause; survives rewording
retrieval_text EMBED THIS. title + prediction, nothing else
prompt_block PASTE THIS. pre-formatted for a model's context
family perf_spec
predicate what the rubric asserts, in words
title one-line statement of the defect
input_condition when the criterion applies
code_requirement the ground truth it is checked against
prediction the falsifiable claim
target_failing_test test predicted red (perf_spec)
target_exception_class exception predicted (error_focused)
source_instance_id instance it was mined from
source_repo upstream repo of that instance
source_dataset swe-gym
library swe_10
library_target the K this library was collected to
text the full rubric markdown
source_file original filename

The criterion is stored split into its three clauses because they do different jobs: input_condition scopes when it applies, code_requirement is the ground truth it is checked against, and prediction is the falsifiable claim. Scoring a rubric means checking the prediction; the other two make that check well-defined.

Provenance and the leakage guarantee

Mined only from SWE-Gym and SWE-smith. SWE-bench was never mined — it is the held-out evaluation target.

Every row carries source_instance_id and source_repo, so the guarantee is checkable from the data rather than taken on trust: no row's source_repo appears in any of SWE-bench's 18 evaluation repos. Audited at export with 0 hits and 0 untraceable rows.

Held out: astropy/astropy, django/django, marshmallow-code/marshmallow, matplotlib/matplotlib, mwaskom/seaborn, pallets/flask, psf/requests, pvlib/pvlib-python, pydata/xarray, pydicom/pydicom, pylint-dev/astroid, pylint-dev/pylint, pytest-dev/pytest, pyvista/pyvista, scikit-learn/scikit-learn, sphinx-doc/sphinx, sqlfluff/sqlfluff, sympy/sympy

Families

  • perf_spec — the code runs and is wrong; predicts a failing unit test. This dominates, because SWE work is mostly "runs and gives the wrong answer" rather than "crashes".
  • error_focused — the change makes the module unimportable or otherwise raises; predicts an exception class.
  • error_grader — the grader rejects the output.

Limitations

  • Mined with a small tool-loop agent, so the failure modes reflect what that agent gets wrong — not the whole space of code defects.
  • error_focused is a small minority. Crashes are genuinely rare in this domain; the family is thin by nature, not by neglect.
  • No precision/recall is published here. Distinctness and provenance are measured; predictive quality is not, and should not be assumed.
Downloads last month
30