task_id stringlengths 12 12 | repo stringlengths 6 11 | difficulty stringclasses 3
values | issue stringlengths 118 229 | files dict | test_files dict | fail_to_pass listlengths 1 1 | gold_patch stringlengths 166 596 | source stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|
swe-mini-001 | stringkit | easy | slugify() is supposed to collapse any run of separators into a single dash, but 'Hello World' becomes 'hello---world' instead of 'hello-world'. Multiple spaces should produce exactly one dash. | {
"core.py": "import re\n\n\ndef slugify(text):\n \"\"\"Lowercase, strip, and replace separators with dashes.\"\"\"\n text = text.strip().lower()\n return re.sub(r\"\\s\", \"-\", text)\n"
} | {
"test_core.py": "from core import slugify\n\n\ndef test_slugify_collapses_whitespace():\n assert slugify(\"Hello World\") == \"hello-world\"\n assert slugify(\" a b \") == \"a-b\"\n"
} | [
"test_core.py::test_slugify_collapses_whitespace"
] | --- a/core.py
+++ b/core.py
@@ -4,4 +4,4 @@
def slugify(text):
"""Lowercase, strip, and replace separators with dashes."""
text = text.strip().lower()
- return re.sub(r"\s", "-", text)
+ return re.sub(r"\s+", "-", text)
| hand-authored, SWE-bench-Lite-style |
swe-mini-002 | mathkit | easy | safe_divide(x, 0) raises ZeroDivisionError and crashes the report generator. When the denominator is zero it should return None instead of raising. | {
"core.py": "def safe_divide(numerator, denominator):\n return numerator / denominator\n"
} | {
"test_core.py": "from core import safe_divide\n\n\ndef test_safe_divide_handles_zero():\n assert safe_divide(10, 2) == 5\n assert safe_divide(10, 0) is None\n"
} | [
"test_core.py::test_safe_divide_handles_zero"
] | --- a/core.py
+++ b/core.py
@@ -1,2 +1,4 @@
def safe_divide(numerator, denominator):
+ if denominator == 0:
+ return None
return numerator / denominator
| hand-authored, SWE-bench-Lite-style |
swe-mini-003 | collectkit | medium | append_item() uses a mutable default argument for the bucket, so items leak between calls that don't pass their own list. Calling it twice without a bucket returns ['a', 'b'] on the second call. | {
"core.py": "def append_item(item, bucket=[]):\n \"\"\"Append item to bucket and return the bucket.\"\"\"\n bucket.append(item)\n return bucket\n"
} | {
"test_core.py": "from core import append_item\n\n\ndef test_append_item_no_shared_default():\n assert append_item(\"a\") == [\"a\"]\n assert append_item(\"b\") == [\"b\"]\n"
} | [
"test_core.py::test_append_item_no_shared_default"
] | --- a/core.py
+++ b/core.py
@@ -1,4 +1,6 @@
-def append_item(item, bucket=[]):
+def append_item(item, bucket=None):
"""Append item to bucket and return the bucket."""
+ if bucket is None:
+ bucket = []
bucket.append(item)
return bucket
| hand-authored, SWE-bench-Lite-style |
swe-mini-004 | pagekit | medium | paginate() drops the final partial page. With 10 items and page_size 3 it returns 3 pages instead of 4 — the last item is lost. The page count should round up. | {
"core.py": "def paginate(items, page_size):\n \"\"\"Split items into pages of at most page_size.\"\"\"\n n_pages = len(items) // page_size\n return [items[i * page_size:(i + 1) * page_size] for i in range(n_pages)]\n"
} | {
"test_core.py": "from core import paginate\n\n\ndef test_paginate_keeps_partial_page():\n pages = paginate(list(range(10)), 3)\n assert len(pages) == 4\n assert pages[-1] == [9]\n"
} | [
"test_core.py::test_paginate_keeps_partial_page"
] | --- a/core.py
+++ b/core.py
@@ -1,4 +1,4 @@
def paginate(items, page_size):
"""Split items into pages of at most page_size."""
- n_pages = len(items) // page_size
+ n_pages = (len(items) + page_size - 1) // page_size
return [items[i * page_size:(i + 1) * page_size] for i in range(n_pages)]
| hand-authored, SWE-bench-Lite-style |
swe-mini-005 | seqkit | easy | fib(0) returns 1 but should return 0. The Fibonacci sequence starts 0, 1, 1, 2, 3 — the base case for n == 0 is wrong. | {
"core.py": "def fib(n):\n \"\"\"Return the nth Fibonacci number (0-indexed).\"\"\"\n if n < 2:\n return 1\n return fib(n - 1) + fib(n - 2)\n"
} | {
"test_core.py": "from core import fib\n\n\ndef test_fib_base_cases():\n assert fib(0) == 0\n assert fib(1) == 1\n assert fib(7) == 13\n"
} | [
"test_core.py::test_fib_base_cases"
] | --- a/core.py
+++ b/core.py
@@ -1,5 +1,5 @@
def fib(n):
"""Return the nth Fibonacci number (0-indexed)."""
if n < 2:
- return 1
+ return n
return fib(n - 1) + fib(n - 2)
| hand-authored, SWE-bench-Lite-style |
swe-mini-006 | listkit | medium | flatten() only goes one level deep. Given [1, [2, [3, 4]]] it returns [1, 2, [3, 4]] instead of [1, 2, 3, 4]. It should flatten arbitrarily nested lists. | {
"core.py": "def flatten(items):\n \"\"\"Flatten a nested list of arbitrary depth.\"\"\"\n result = []\n for item in items:\n if isinstance(item, list):\n result.extend(item)\n else:\n result.append(item)\n return result\n"
} | {
"test_core.py": "from core import flatten\n\n\ndef test_flatten_deeply_nested():\n assert flatten([1, [2, [3, 4]]]) == [1, 2, 3, 4]\n assert flatten([[1], [[2]], 3]) == [1, 2, 3]\n"
} | [
"test_core.py::test_flatten_deeply_nested"
] | --- a/core.py
+++ b/core.py
@@ -3,7 +3,7 @@
result = []
for item in items:
if isinstance(item, list):
- result.extend(item)
+ result.extend(flatten(item))
else:
result.append(item)
return result
| hand-authored, SWE-bench-Lite-style |
swe-mini-007 | dictkit | medium | deep_merge() overwrites nested dicts wholesale instead of merging them. merging {'a': {'x': 1}} with {'a': {'y': 2}} loses 'x'. Nested dicts on both sides should be merged recursively. | {
"core.py": "def deep_merge(base, override):\n \"\"\"Recursively merge override into a copy of base.\"\"\"\n result = dict(base)\n for key, value in override.items():\n result[key] = value\n return result\n"
} | {
"test_core.py": "from core import deep_merge\n\n\ndef test_deep_merge_preserves_nested_keys():\n merged = deep_merge({\"a\": {\"x\": 1}}, {\"a\": {\"y\": 2}})\n assert merged == {\"a\": {\"x\": 1, \"y\": 2}}\n"
} | [
"test_core.py::test_deep_merge_preserves_nested_keys"
] | --- a/core.py
+++ b/core.py
@@ -2,5 +2,8 @@
"""Recursively merge override into a copy of base."""
result = dict(base)
for key, value in override.items():
- result[key] = value
+ if isinstance(value, dict) and isinstance(result.get(key), dict):
+ result[key] = deep_merge(result[ke... | hand-authored, SWE-bench-Lite-style |
swe-mini-008 | searchkit | medium | binary_search() misses the last element of the array. Searching for the largest value returns -1 because the high bound is set to len(arr) - 1 but the loop condition excludes it. | {
"core.py": "def binary_search(arr, target):\n \"\"\"Return the index of target in sorted arr, or -1.\"\"\"\n low, high = 0, len(arr) - 1\n while low < high:\n mid = (low + high) // 2\n if arr[mid] == target:\n return mid\n elif arr[mid] < target:\n low = mid + 1\n... | {
"test_core.py": "from core import binary_search\n\n\ndef test_binary_search_finds_last():\n arr = [1, 3, 5, 7, 9]\n assert binary_search(arr, 9) == 4\n assert binary_search(arr, 1) == 0\n assert binary_search(arr, 4) == -1\n"
} | [
"test_core.py::test_binary_search_finds_last"
] | --- a/core.py
+++ b/core.py
@@ -1,7 +1,7 @@
def binary_search(arr, target):
"""Return the index of target in sorted arr, or -1."""
low, high = 0, len(arr) - 1
- while low < high:
+ while low <= high:
mid = (low + high) // 2
if arr[mid] == target:
return mid
| hand-authored, SWE-bench-Lite-style |
swe-mini-009 | tempkit | easy | celsius_to_fahrenheit() uses the wrong formula — it multiplies by 9/5 but forgets to add 32, so 100C comes out as 180 instead of 212. | {
"core.py": "def celsius_to_fahrenheit(celsius):\n \"\"\"Convert Celsius to Fahrenheit.\"\"\"\n return celsius * 9 / 5\n"
} | {
"test_core.py": "from core import celsius_to_fahrenheit\n\n\ndef test_celsius_to_fahrenheit():\n assert celsius_to_fahrenheit(0) == 32\n assert celsius_to_fahrenheit(100) == 212\n"
} | [
"test_core.py::test_celsius_to_fahrenheit"
] | --- a/core.py
+++ b/core.py
@@ -1,3 +1,3 @@
def celsius_to_fahrenheit(celsius):
"""Convert Celsius to Fahrenheit."""
- return celsius * 9 / 5
+ return celsius * 9 / 5 + 32
| hand-authored, SWE-bench-Lite-style |
swe-mini-010 | orderkit | easy | dedupe() sorts its output instead of preserving first-seen order. For ['b', 'a', 'b', 'c', 'a'] it returns ['a', 'b', 'c'] but should return ['b', 'a', 'c'] — duplicates removed, original order kept. | {
"core.py": "def dedupe(items):\n \"\"\"Remove duplicates, preserving first-seen order.\"\"\"\n return sorted(set(items))\n"
} | {
"test_core.py": "from core import dedupe\n\n\ndef test_dedupe_preserves_order():\n assert dedupe([\"b\", \"a\", \"b\", \"c\", \"a\"]) == [\"b\", \"a\", \"c\"]\n"
} | [
"test_core.py::test_dedupe_preserves_order"
] | --- a/core.py
+++ b/core.py
@@ -1,3 +1,9 @@
def dedupe(items):
"""Remove duplicates, preserving first-seen order."""
- return sorted(set(items))
+ seen = set()
+ result = []
+ for item in items:
+ if item not in seen:
+ seen.add(item)
+ result.append(item)
+ return resu... | hand-authored, SWE-bench-Lite-style |
swe-mini-011 | clampkit | easy | clamp() has its min and max swapped, so clamp(5, 0, 10) returns 0 instead of 5. Values inside the range should pass through unchanged. | {
"core.py": "def clamp(value, low, high):\n \"\"\"Clamp value into the inclusive range [low, high].\"\"\"\n return max(high, min(low, value))\n"
} | {
"test_core.py": "from core import clamp\n\n\ndef test_clamp_range():\n assert clamp(5, 0, 10) == 5\n assert clamp(-3, 0, 10) == 0\n assert clamp(42, 0, 10) == 10\n"
} | [
"test_core.py::test_clamp_range"
] | --- a/core.py
+++ b/core.py
@@ -1,3 +1,3 @@
def clamp(value, low, high):
"""Clamp value into the inclusive range [low, high]."""
- return max(high, min(low, value))
+ return max(low, min(high, value))
| hand-authored, SWE-bench-Lite-style |
swe-mini-012 | retrykit | medium | retry() runs the function one fewer time than requested. With attempts=3 and a function that fails twice then succeeds, it gives up after 2 tries and raises. It should make exactly `attempts` calls. | {
"core.py": "def retry(func, attempts=3):\n \"\"\"Call func up to `attempts` times until it does not raise.\"\"\"\n last_exc = None\n for _ in range(attempts - 1):\n try:\n return func()\n except Exception as exc:\n last_exc = exc\n raise last_exc\n"
} | {
"test_core.py": "from core import retry\n\n\ndef test_retry_uses_all_attempts():\n state = {'calls': 0}\n\n def flaky():\n state['calls'] += 1\n if state['calls'] < 3:\n raise ValueError('not yet')\n return 'ok'\n\n assert retry(flaky, attempts=3) == 'ok'\n assert state['... | [
"test_core.py::test_retry_uses_all_attempts"
] | --- a/core.py
+++ b/core.py
@@ -1,7 +1,7 @@
def retry(func, attempts=3):
"""Call func up to `attempts` times until it does not raise."""
last_exc = None
- for _ in range(attempts - 1):
+ for _ in range(attempts):
try:
return func()
except Exception as exc:
| hand-authored, SWE-bench-Lite-style |
swe-mini-013 | cachekit | hard | The LRU cache evicts the most-recently-used entry instead of the least-recently-used one. After filling a cache of size 2 and touching the first key, inserting a third key should evict the untouched key, not the one we just read. | {
"core.py": "from collections import OrderedDict\n\n\nclass LRUCache:\n \"\"\"Fixed-capacity cache that evicts the least-recently-used key.\"\"\"\n\n def __init__(self, capacity):\n self.capacity = capacity\n self.store = OrderedDict()\n\n def get(self, key):\n if key not in self.store:... | {
"test_core.py": "from core import LRUCache\n\n\ndef test_lru_evicts_least_recently_used():\n cache = LRUCache(2)\n cache.put(\"a\", 1)\n cache.put(\"b\", 2)\n assert cache.get(\"a\") == 1\n cache.put(\"c\", 3)\n assert cache.get(\"b\") is None\n assert cache.get(\"a\") == 1\n assert cache.ge... | [
"test_core.py::test_lru_evicts_least_recently_used"
] | --- a/core.py
+++ b/core.py
@@ -11,10 +11,11 @@
def get(self, key):
if key not in self.store:
return None
+ self.store.move_to_end(key)
return self.store[key]
def put(self, key, value):
self.store[key] = value
self.store.move_to_end(key)
if le... | hand-authored, SWE-bench-Lite-style |
swe-mini-014 | datekit | medium | date_range() is documented as inclusive of the end date but excludes it. date_range(date(2024,1,1), date(2024,1,3)) returns two days instead of three. | {
"core.py": "from datetime import timedelta\n\n\ndef date_range(start, end):\n \"\"\"Return all dates from start to end, inclusive.\"\"\"\n days = (end - start).days\n return [start + timedelta(days=i) for i in range(days)]\n"
} | {
"test_core.py": "from datetime import date\n\nfrom core import date_range\n\n\ndef test_date_range_is_inclusive():\n rng = date_range(date(2024, 1, 1), date(2024, 1, 3))\n assert len(rng) == 3\n assert rng[-1] == date(2024, 1, 3)\n"
} | [
"test_core.py::test_date_range_is_inclusive"
] | --- a/core.py
+++ b/core.py
@@ -4,4 +4,4 @@
def date_range(start, end):
"""Return all dates from start to end, inclusive."""
days = (end - start).days
- return [start + timedelta(days=i) for i in range(days)]
+ return [start + timedelta(days=i) for i in range(days + 1)]
| hand-authored, SWE-bench-Lite-style |
swe-mini-015 | csvkit | medium | parse_row() splits on every comma, so quoted fields containing commas are torn apart. 'a,"b,c",d' should parse to three fields ['a', 'b,c', 'd'] but currently yields four. | {
"core.py": "def parse_row(line):\n \"\"\"Parse one CSV row into a list of fields.\"\"\"\n return line.split(\",\")\n"
} | {
"test_core.py": "from core import parse_row\n\n\ndef test_parse_row_respects_quotes():\n assert parse_row('a,\"b,c\",d') == [\"a\", \"b,c\", \"d\"]\n"
} | [
"test_core.py::test_parse_row_respects_quotes"
] | --- a/core.py
+++ b/core.py
@@ -1,3 +1,7 @@
+import csv
+import io
+
+
def parse_row(line):
"""Parse one CSV row into a list of fields."""
- return line.split(",")
+ return next(csv.reader(io.StringIO(line)))
| hand-authored, SWE-bench-Lite-style |
swe-mini-016 | wordkit | easy | word_count() counts empty strings when the text has trailing or double spaces, so 'a b ' reports 4 words instead of 2. split() with no argument already handles this. | {
"core.py": "def word_count(text):\n \"\"\"Count the words in text.\"\"\"\n return len(text.split(\" \"))\n"
} | {
"test_core.py": "from core import word_count\n\n\ndef test_word_count_ignores_extra_spaces():\n assert word_count(\"a b \") == 2\n assert word_count(\"one two three\") == 3\n"
} | [
"test_core.py::test_word_count_ignores_extra_spaces"
] | --- a/core.py
+++ b/core.py
@@ -1,3 +1,3 @@
def word_count(text):
"""Count the words in text."""
- return len(text.split(" "))
+ return len(text.split())
| hand-authored, SWE-bench-Lite-style |
swe-mini-017 | palinkit | easy | is_palindrome() is case-sensitive and counts punctuation, so 'A man, a plan, a canal: Panama' is reported as not a palindrome. It should ignore case and non-alphanumeric characters. | {
"core.py": "def is_palindrome(text):\n \"\"\"Return True if text reads the same forwards and backwards.\"\"\"\n return text == text[::-1]\n"
} | {
"test_core.py": "from core import is_palindrome\n\n\ndef test_is_palindrome_ignores_case_and_punctuation():\n assert is_palindrome(\"A man, a plan, a canal: Panama\")\n assert not is_palindrome(\"hello\")\n"
} | [
"test_core.py::test_is_palindrome_ignores_case_and_punctuation"
] | --- a/core.py
+++ b/core.py
@@ -1,3 +1,4 @@
def is_palindrome(text):
"""Return True if text reads the same forwards and backwards."""
- return text == text[::-1]
+ cleaned = [c.lower() for c in text if c.isalnum()]
+ return cleaned == cleaned[::-1]
| hand-authored, SWE-bench-Lite-style |
swe-mini-018 | statskit | medium | median() returns the wrong value for even-length inputs — it picks the upper-middle element instead of averaging the two middle elements. median([1, 2, 3, 4]) should be 2.5, not 3. | {
"core.py": "def median(values):\n \"\"\"Return the median of a list of numbers.\"\"\"\n ordered = sorted(values)\n mid = len(ordered) // 2\n return ordered[mid]\n"
} | {
"test_core.py": "from core import median\n\n\ndef test_median_even_length():\n assert median([1, 2, 3, 4]) == 2.5\n assert median([5, 1, 3]) == 3\n"
} | [
"test_core.py::test_median_even_length"
] | --- a/core.py
+++ b/core.py
@@ -2,4 +2,6 @@
"""Return the median of a list of numbers."""
ordered = sorted(values)
mid = len(ordered) // 2
+ if len(ordered) % 2 == 0:
+ return (ordered[mid - 1] + ordered[mid]) / 2
return ordered[mid]
| hand-authored, SWE-bench-Lite-style |
swe-mini-019 | rangekit | medium | running_total() reports cumulative sums but is off by one: the first element is omitted, so running_total([1, 2, 3]) returns [1, 3] instead of [1, 3, 6]. | {
"core.py": "def running_total(values):\n \"\"\"Return the list of cumulative sums.\"\"\"\n totals = []\n acc = 0\n for value in values[1:]:\n acc += value\n totals.append(acc)\n return totals\n"
} | {
"test_core.py": "from core import running_total\n\n\ndef test_running_total_includes_first():\n assert running_total([1, 2, 3]) == [1, 3, 6]\n"
} | [
"test_core.py::test_running_total_includes_first"
] | --- a/core.py
+++ b/core.py
@@ -2,7 +2,7 @@
"""Return the list of cumulative sums."""
totals = []
acc = 0
- for value in values[1:]:
+ for value in values:
acc += value
totals.append(acc)
return totals
| hand-authored, SWE-bench-Lite-style |
swe-mini-020 | titlekit | medium | title_case() uppercases the letter after an apostrophe, so "don't stop" becomes "Don'T Stop". Only the first letter of each space-separated word should be capitalized; the rest of the word should be left untouched. | {
"core.py": "def title_case(text):\n \"\"\"Capitalize the first letter of each word.\"\"\"\n return text.title()\n"
} | {
"test_core.py": "from core import title_case\n\n\ndef test_title_case_keeps_apostrophes():\n assert title_case(\"don't stop\") == \"Don't Stop\"\n"
} | [
"test_core.py::test_title_case_keeps_apostrophes"
] | --- a/core.py
+++ b/core.py
@@ -1,3 +1,3 @@
def title_case(text):
"""Capitalize the first letter of each word."""
- return text.title()
+ return " ".join(word[:1].upper() + word[1:] for word in text.split(" "))
| hand-authored, SWE-bench-Lite-style |
swe-mini-021 | windowkit | hard | sliding_max() returns the max of the whole list repeated, instead of the max within each window of size k. For [1, 3, 2, 5, 4] with k=2 it should return [3, 3, 5, 5]. | {
"core.py": "def sliding_max(values, k):\n \"\"\"Return the max of each contiguous window of size k.\"\"\"\n overall = max(values)\n return [overall for _ in range(len(values) - k + 1)]\n"
} | {
"test_core.py": "from core import sliding_max\n\n\ndef test_sliding_max_window():\n assert sliding_max([1, 3, 2, 5, 4], 2) == [3, 3, 5, 5]\n"
} | [
"test_core.py::test_sliding_max_window"
] | --- a/core.py
+++ b/core.py
@@ -1,4 +1,3 @@
def sliding_max(values, k):
"""Return the max of each contiguous window of size k."""
- overall = max(values)
- return [overall for _ in range(len(values) - k + 1)]
+ return [max(values[i:i + k]) for i in range(len(values) - k + 1)]
| hand-authored, SWE-bench-Lite-style |
swe-mini-022 | versionkit | medium | compare_versions() compares version strings lexically, so '1.10' is treated as less than '1.9'. Components should be compared numerically: compare_versions('1.10', '1.9') should return 1. | {
"core.py": "def compare_versions(a, b):\n \"\"\"Return -1, 0, or 1 comparing dotted version strings.\"\"\"\n if a < b:\n return -1\n if a > b:\n return 1\n return 0\n"
} | {
"test_core.py": "from core import compare_versions\n\n\ndef test_compare_versions_numeric():\n assert compare_versions(\"1.10\", \"1.9\") == 1\n assert compare_versions(\"1.2\", \"1.2\") == 0\n assert compare_versions(\"2.0\", \"10.0\") == -1\n"
} | [
"test_core.py::test_compare_versions_numeric"
] | --- a/core.py
+++ b/core.py
@@ -1,7 +1,9 @@
def compare_versions(a, b):
"""Return -1, 0, or 1 comparing dotted version strings."""
- if a < b:
+ pa = [int(p) for p in a.split(".")]
+ pb = [int(p) for p in b.split(".")]
+ if pa < pb:
return -1
- if a > b:
+ if pa > pb:
return 1
... | hand-authored, SWE-bench-Lite-style |
swe-mini-023 | intervalkit | easy | in_range() is documented as inclusive of both endpoints but uses a strict upper comparison, so in_range(10, 0, 10) returns False. A value equal to the high bound should be considered in range. | {
"core.py": "def in_range(value, low, high):\n \"\"\"Return True if low <= value <= high (inclusive).\"\"\"\n return low <= value < high\n"
} | {
"test_core.py": "from core import in_range\n\n\ndef test_in_range_includes_upper_bound():\n assert in_range(10, 0, 10) is True\n assert in_range(0, 0, 10) is True\n assert in_range(11, 0, 10) is False\n"
} | [
"test_core.py::test_in_range_includes_upper_bound"
] | --- a/core.py
+++ b/core.py
@@ -1,3 +1,3 @@
def in_range(value, low, high):
"""Return True if low <= value <= high (inclusive)."""
- return low <= value < high
+ return low <= value <= high
| hand-authored, SWE-bench-Lite-style |
swe-mini-024 | roundkit | easy | round_money() is meant to round to 2 decimal places by default for currency, but the default ndigits is 0, so round_money(1.005) returns 1.0 instead of 1.0 cents precision. The default should be 2. | {
"core.py": "def round_money(amount, ndigits=0):\n \"\"\"Round a monetary amount, defaulting to cents (2 dp).\"\"\"\n return round(amount, ndigits)\n"
} | {
"test_core.py": "from core import round_money\n\n\ndef test_round_money_defaults_to_cents():\n assert round_money(1.239) == 1.24\n assert round_money(10.0) == 10.0\n assert round_money(3.14159, 3) == 3.142\n"
} | [
"test_core.py::test_round_money_defaults_to_cents"
] | --- a/core.py
+++ b/core.py
@@ -1,3 +1,3 @@
-def round_money(amount, ndigits=0):
+def round_money(amount, ndigits=2):
"""Round a monetary amount, defaulting to cents (2 dp)."""
return round(amount, ndigits)
| hand-authored, SWE-bench-Lite-style |
swe-mini-025 | tallykit | medium | count_word() uses a mutable dict as its default counts argument, so tallies leak between calls that don't pass their own counter. Calling it twice without a counter accumulates the first call's result. | {
"core.py": "def count_word(word, counts={}):\n \"\"\"Increment word in counts and return counts.\"\"\"\n counts[word] = counts.get(word, 0) + 1\n return counts\n"
} | {
"test_core.py": "from core import count_word\n\n\ndef test_count_word_no_shared_default():\n assert count_word(\"a\") == {\"a\": 1}\n assert count_word(\"b\") == {\"b\": 1}\n"
} | [
"test_core.py::test_count_word_no_shared_default"
] | --- a/core.py
+++ b/core.py
@@ -1,4 +1,6 @@
-def count_word(word, counts={}):
+def count_word(word, counts=None):
"""Increment word in counts and return counts."""
+ if counts is None:
+ counts = {}
counts[word] = counts.get(word, 0) + 1
return counts
| hand-authored, SWE-bench-Lite-style |
swe-mini-026 | emailkit | medium | is_valid_email() accepts strings with extra text around the address because the pattern is not anchored, so 'bad x@y.com bad' is reported as valid. The whole string must match the pattern, not just a part. | {
"core.py": "import re\n\n\ndef is_valid_email(text):\n \"\"\"Return True if text is a single valid email address.\"\"\"\n return re.search(r\"[^@\\s]+@[^@\\s]+\\.[^@\\s]+\", text) is not None\n"
} | {
"test_core.py": "from core import is_valid_email\n\n\ndef test_is_valid_email_anchors_whole_string():\n assert is_valid_email(\"user@example.com\") is True\n assert is_valid_email(\"bad user@example.com bad\") is False\n assert is_valid_email(\"no-at-sign\") is False\n"
} | [
"test_core.py::test_is_valid_email_anchors_whole_string"
] | --- a/core.py
+++ b/core.py
@@ -3,4 +3,4 @@
def is_valid_email(text):
"""Return True if text is a single valid email address."""
- return re.search(r"[^@\s]+@[^@\s]+\.[^@\s]+", text) is not None
+ return re.fullmatch(r"[^@\s]+@[^@\s]+\.[^@\s]+", text) is not None
| hand-authored, SWE-bench-Lite-style |
swe-mini-027 | passkit | medium | is_strong_password() uses 'or' between its requirements, so any single satisfied rule makes it return True — 'aaaaaaaa' passes. A strong password must satisfy ALL the rules (length, digit, and uppercase). | {
"core.py": "def is_strong_password(pw):\n \"\"\"Strong password: >=8 chars, has a digit, has an uppercase letter.\"\"\"\n return (\n len(pw) >= 8\n or any(c.isdigit() for c in pw)\n or any(c.isupper() for c in pw)\n )\n"
} | {
"test_core.py": "from core import is_strong_password\n\n\ndef test_is_strong_password_requires_all_rules():\n assert is_strong_password(\"Abcdef12\") is True\n assert is_strong_password(\"aaaaaaaa\") is False\n assert is_strong_password(\"Ab1\") is False\n"
} | [
"test_core.py::test_is_strong_password_requires_all_rules"
] | --- a/core.py
+++ b/core.py
@@ -2,6 +2,6 @@
"""Strong password: >=8 chars, has a digit, has an uppercase letter."""
return (
len(pw) >= 8
- or any(c.isdigit() for c in pw)
- or any(c.isupper() for c in pw)
+ and any(c.isdigit() for c in pw)
+ and any(c.isupper() for c in p... | hand-authored, SWE-bench-Lite-style |
swe-mini-028 | avgkit | easy | average() raises ZeroDivisionError on an empty list, which crashes the dashboard when a series has no samples yet. An empty input should return 0.0 instead of raising. | {
"core.py": "def average(values):\n \"\"\"Return the arithmetic mean of values, or 0.0 if empty.\"\"\"\n return sum(values) / len(values)\n"
} | {
"test_core.py": "from core import average\n\n\ndef test_average_handles_empty():\n assert average([2, 4, 6]) == 4\n assert average([]) == 0.0\n"
} | [
"test_core.py::test_average_handles_empty"
] | --- a/core.py
+++ b/core.py
@@ -1,3 +1,5 @@
def average(values):
"""Return the arithmetic mean of values, or 0.0 if empty."""
+ if not values:
+ return 0.0
return sum(values) / len(values)
| hand-authored, SWE-bench-Lite-style |
swe-mini-029 | bizdaykit | medium | is_weekend() only treats Sunday as part of the weekend and misses Saturday, so a Saturday date is reported as a weekday. Both Saturday and Sunday should count as the weekend. | {
"core.py": "def is_weekend(d):\n \"\"\"Return True if date d falls on Saturday or Sunday.\"\"\"\n return d.weekday() == 6\n"
} | {
"test_core.py": "from datetime import date\n\nfrom core import is_weekend\n\n\ndef test_is_weekend_includes_saturday():\n assert is_weekend(date(2024, 1, 6)) is True # Saturday\n assert is_weekend(date(2024, 1, 7)) is True # Sunday\n assert is_weekend(date(2024, 1, 8)) is False # Monday\n"
} | [
"test_core.py::test_is_weekend_includes_saturday"
] | --- a/core.py
+++ b/core.py
@@ -1,3 +1,3 @@
def is_weekend(d):
"""Return True if date d falls on Saturday or Sunday."""
- return d.weekday() == 6
+ return d.weekday() >= 5
| hand-authored, SWE-bench-Lite-style |
swe-mini-030 | querykit | medium | parse_query() splits a 'k=v&k2=v2' query string but mishandles values that themselves contain '=', so parsing 'token=a=b' yields 'a' and drops the rest. Only the first '=' should separate key from value. | {
"core.py": "def parse_query(qs):\n \"\"\"Parse a k=v&k2=v2 query string into a dict.\"\"\"\n result = {}\n for pair in qs.split(\"&\"):\n if not pair:\n continue\n key, value = pair.split(\"=\")\n result[key] = value\n return result\n"
} | {
"test_core.py": "from core import parse_query\n\n\ndef test_parse_query_splits_on_first_equals():\n assert parse_query(\"a=1&b=2\") == {\"a\": \"1\", \"b\": \"2\"}\n assert parse_query(\"token=a=b\") == {\"token\": \"a=b\"}\n"
} | [
"test_core.py::test_parse_query_splits_on_first_equals"
] | --- a/core.py
+++ b/core.py
@@ -4,6 +4,6 @@
for pair in qs.split("&"):
if not pair:
continue
- key, value = pair.split("=")
+ key, value = pair.split("=", 1)
result[key] = value
return result
| hand-authored, SWE-bench-Lite-style |
swe-mini-031 | primekit | easy | is_prime() treats 1 as prime and rejects 2, because the early guard uses the wrong comparison: it returns False for n < 1 instead of n < 2. 1 is not prime and 2 is. | {
"core.py": "def is_prime(n):\n \"\"\"Return True if n is a prime number.\"\"\"\n if n < 1:\n return False\n for d in range(2, int(n ** 0.5) + 1):\n if n % d == 0:\n return False\n return True\n"
} | {
"test_core.py": "from core import is_prime\n\n\ndef test_is_prime_handles_small_numbers():\n assert is_prime(1) is False\n assert is_prime(2) is True\n assert is_prime(3) is True\n assert is_prime(4) is False\n"
} | [
"test_core.py::test_is_prime_handles_small_numbers"
] | --- a/core.py
+++ b/core.py
@@ -1,6 +1,6 @@
def is_prime(n):
"""Return True if n is a prime number."""
- if n < 1:
+ if n < 2:
return False
for d in range(2, int(n ** 0.5) + 1):
if n % d == 0:
| hand-authored, SWE-bench-Lite-style |
swe-mini-032 | bracketkit | hard | is_balanced() only counts opening and closing brackets, so it accepts mismatched pairs like '[(])' as balanced. It must track nesting order with a stack so each closer matches the most recent opener. | {
"core.py": "def is_balanced(text):\n \"\"\"Return True if brackets in text are correctly balanced/nested.\"\"\"\n pairs = {\")\": \"(\", \"]\": \"[\", \"}\": \"{\"}\n openers = set(pairs.values())\n closers = set(pairs)\n open_count = sum(1 for c in text if c in openers)\n close_count = sum(1 for ... | {
"test_core.py": "from core import is_balanced\n\n\ndef test_is_balanced_respects_nesting_order():\n assert is_balanced(\"([])\") is True\n assert is_balanced(\"[(])\") is False\n assert is_balanced(\"(((\") is False\n"
} | [
"test_core.py::test_is_balanced_respects_nesting_order"
] | --- a/core.py
+++ b/core.py
@@ -2,7 +2,11 @@
"""Return True if brackets in text are correctly balanced/nested."""
pairs = {")": "(", "]": "[", "}": "{"}
openers = set(pairs.values())
- closers = set(pairs)
- open_count = sum(1 for c in text if c in openers)
- close_count = sum(1 for c in text if... | hand-authored, SWE-bench-Lite-style |
swe-mini-033 | truncatekit | medium | truncate() is meant to cap a string at `limit` characters and append an ellipsis, but it slices to limit-1 and so drops one extra character. 'abcdef' with limit 5 should give 'abcde...', not 'abcd...'. | {
"core.py": "def truncate(text, limit):\n \"\"\"Cap text at limit chars, adding an ellipsis if it was cut.\"\"\"\n if len(text) <= limit:\n return text\n return text[:limit - 1] + \"...\"\n"
} | {
"test_core.py": "from core import truncate\n\n\ndef test_truncate_keeps_limit_chars():\n assert truncate(\"abcdef\", 5) == \"abcde...\"\n assert truncate(\"hi\", 5) == \"hi\"\n"
} | [
"test_core.py::test_truncate_keeps_limit_chars"
] | --- a/core.py
+++ b/core.py
@@ -2,4 +2,4 @@
"""Cap text at limit chars, adding an ellipsis if it was cut."""
if len(text) <= limit:
return text
- return text[:limit - 1] + "..."
+ return text[:limit] + "..."
| hand-authored, SWE-bench-Lite-style |
swe-mini-034 | groupkit | medium | chunk() should split a sequence into consecutive groups of size n, but it steps by 1 instead of n, producing overlapping sliding windows. chunk([1,2,3,4,5], 2) should be [[1,2],[3,4],[5]], not overlapping. | {
"core.py": "def chunk(seq, n):\n \"\"\"Split seq into consecutive non-overlapping chunks of size n.\"\"\"\n return [seq[i:i + n] for i in range(0, len(seq))]\n"
} | {
"test_core.py": "from core import chunk\n\n\ndef test_chunk_is_non_overlapping():\n assert chunk([1, 2, 3, 4, 5], 2) == [[1, 2], [3, 4], [5]]\n assert chunk([1, 2, 3, 4], 2) == [[1, 2], [3, 4]]\n"
} | [
"test_core.py::test_chunk_is_non_overlapping"
] | --- a/core.py
+++ b/core.py
@@ -1,3 +1,3 @@
def chunk(seq, n):
"""Split seq into consecutive non-overlapping chunks of size n."""
- return [seq[i:i + n] for i in range(0, len(seq))]
+ return [seq[i:i + n] for i in range(0, len(seq), n)]
| hand-authored, SWE-bench-Lite-style |
SWE-bench-mini
34 self-contained bug-fix tasks in the SWE-bench format — a small repository snapshot
carrying a defect, a test that fails because of it, and a gold patch that fixes it (difficulty
mix: 12 easy / 19 medium / 3 hard, author estimate). Built for the swe_bench_mini agent and the
make demo-swe-mini evaluator in
adk-agent-playground, to demonstrate
the framework's range on code-modification and to exercise the CaMeL filesystem-capability gate.
A second harder config (28 tasks, swe_bench_mini_harder.jsonl) exists because 2026
frontier CLIs saturate the default split (34/34 single-shot), which makes ensemble-vs-single-model
questions unanswerable on it. The harder split raises difficulty honestly: real library code with
reintroduced upstream defects (django ValidationError equality, humanize boundary/grouping/teens
bugs, toolz take_nth, with license attribution), correct-but-naive implementations whose stated
input bounds (up to 10^18) force an algorithm replacement inside an explicit per-call time budget
(digit DP, min-plus matrix exponentiation, fast doubling, factoradic unranking), spec-compliance
defects where the obvious fix is wrong (RFC 6901 escape ordering, strict Roman numerals, ISO 8601
week dates, fnmatch semantics), and QuixBugs-style single-defect classics. Tests are shown to the
solver in full, so they are built to resist hardcoding: in-test brute-force cross-checks,
self-verifying properties (rank round-trips, full-range round-trips), and pinned values only where
two independent implementations agreed during authoring. Every task is validated by the gold-patch
oracle (buggy fails, gold passes) in CI.
What a task is
| field | meaning |
|---|---|
task_id |
stable id, e.g. swe-mini-007 |
repo |
a fictional single-module package name |
difficulty |
easy / medium / hard (author estimate, uncalibrated) |
issue |
natural-language bug report in a reporter's voice |
files |
snapshot path → source, carrying the defect |
test_files |
test path → source; the test pins the defect |
fail_to_pass |
pytest node ids the fix must make pass (scored as a conjunction); on the default split every id fails pre-fix, on the harder slice some ids double as regression guards that already pass pre-fix, and at least one id always fails pre-fix |
gold_patch |
unified diff (git a//b/ headers) that resolves the defect |
source |
provenance tag |
A harness materializes files + test_files into a throwaway directory — that directory is the
"repo snapshot" the agent edits. The gold patch resolves every task (it validates the harness,
not agent skill).
Measured baselines (real, single-shot)
Three frontier models, each given a buggy file + the failing test and asked for a corrected file,
scored by the exact fail_to_pass test (up to 3 attempts to absorb transient CLI flakiness). Run
free via local CLI subscriptions — no paid API. This is the first measured number in the
source project (provenance ledger).
| model (via CLI) | solved | 95% bootstrap CI |
|---|---|---|
| Claude (Claude Code CLI) | 34/34 | 100.0% [100.0%, 100.0%] |
| Codex (codex CLI) | 34/34 | 100.0% [100.0%, 100.0%] |
| Gemini (gemini CLI) | 32/34 | 94.1% [85.3%, 100.0%] |
Single-shot patch generation, not the full agentic harness. Gemini's 2 misses were
gemini-CLI infrastructure errors ("API returned invalid content"), not incorrect fixes. The
practical reading: these tasks sit within frontier single-shot capability — so the suite is a
harness/format validator and a CLI-reliability probe, not a frontier-discriminating benchmark.
Reproduce with make demo-swe-cli in the source repo.
Measured on the harder config (2026-07-02): a pre-registered null
Best-of-N with verifier selection over a cross-vendor CLI pool (the gemini CLI is excluded: its individual tier was deprecated upstream), kill criteria fixed before the run:
| system | solved | 95% bootstrap CI |
|---|---|---|
| Claude (Claude Code CLI) | 28/28 | 100.0% [100.0%, 100.0%] |
| Codex (codex CLI) | 28/28 | 100.0% [100.0%, 100.0%] |
| GLM (glm-4.7 via claude-code CLI) | 25/28 | 89.3% [75.0%, 100.0%] |
| ensemble (best-of-3, verifier-select) | 28/28 | 100.0% [100.0%, 100.0%] |
Lift over the best single model: +0.0 pts (95% paired-bootstrap CI [+0.0, +0.0]). The kill-gate fired: even the hardened slice is saturated for two of three models, and GLM's 3 misses (django equality, Josephus at n=10^12, ISO week dates) are fully covered by the rest of the pool, with zero CLI infrastructure errors. The split discriminates (GLM lands at 89.3% with real failures); the 2026 frontier ceiling is simply above single-file bug-fixing with visible tests. Raw per-cell evidence and the full decorrelation matrix live in the source repo and re-derive in CI.
Honest scope — read before citing a pass rate
These tasks are hand-authored bug-fix problems written in the SWE-bench format. They are
not drawn from the SWE-bench Lite split and are not real GitHub issues — the repo
names are fictional single-module packages. They exist to be self-contained, offline, and
dependency-free so the evaluator runs with no network and no large repo checkouts. A pass rate
on this set is a measure of behaviour on small synthetic defects, not a SWE-bench score; do
not compare it to SWE-bench Lite/Verified numbers. The difficulty field is an author estimate.
Intended use
- A tiny, offline, dependency-free harness for iterating on a code-modification agent.
- A testbed for filesystem-capability gating (the agent's tools are confined to the snapshot; a patch escaping the sandbox or touching a denylisted path is rejected).
Related artifacts
- Space — harness-science-evolution: the live ablation + governed-evolution demo from the same project.
- Sibling datasets — belnap-contested-questions · mast-failure-mode-gold.
- Source — github.com/barissozudogru/adk-agent-playground.
License
MIT, matching the source project.
- Downloads last month
- 74