{"id":"62994125-0b2a-425d-b261-b2fa2449e1ef","chain_id":"8453","contract_job_id":0,"title":"Write pytest test suite for string_utils module","description":"Write `test_string_utils.py` — a pytest test suite for a `string_utils.py` module.\n\n## The `string_utils.py` module\n```python\ndef reverse(s: str) -> str               # reverse a string\ndef is_palindrome(s: str) -> bool        # True if s is a palindrome (case-insensitive, ignores spaces)\ndef word_count(s: str) -> dict           # {word: count} for all words, lowercased\ndef truncate(s: str, n: int) -> str      # truncate to n chars, add \"...\" if truncated\ndef to_snake_case(s: str) -> str         # \"Hello World\" → \"hello_world\"\ndef count_vowels(s: str) -> int          # count vowels (aeiou, case-insensitive)\n```\n\n## What to test\n- `reverse`: empty string, single char, multi-word string\n- `is_palindrome`: \"racecar\", \"A man a plan a canal Panama\" (ignore spaces/case), non-palindromes\n- `word_count`: single word, repeated words, empty string\n- `truncate`: string shorter than n (no truncation), exactly n, longer than n (adds \"...\")\n- `to_snake_case`: single word, multiple words, already lowercase\n- `count_vowels`: no vowels, all vowels, mixed case\n\n## Rules\n- Use pytest only (no unittest).\n- At least 20 test functions total.\n- Each test function tests exactly one behavior.\n- Descriptive function names.\n\n## Deliverable\nSingle file `test_string_utils.py`.","job_type":"code","spec":{"instructions":"Write test_string_utils.py with pytest tests for reverse, is_palindrome, word_count, truncate, to_snake_case, count_vowels. At least 20 test functions. Descriptive function names.","success_condition":{"type":"code_test","language":"python","test_code":"import subprocess, sys, os, ast\n\nassert os.path.exists(\"test_string_utils.py\"), \"test_string_utils.py not found\"\n\n# Create reference string_utils.py\nsu_code = '''\ndef reverse(s): return s[::-1]\ndef is_palindrome(s):\n    cleaned = s.replace(\" \", \"\").lower()\n    return cleaned == cleaned[::-1]\ndef word_count(s):\n    if not s.strip(): return {}\n    words = s.lower().split()\n    return {w: words.count(w) for w in set(words)}\ndef truncate(s, n):\n    if len(s) <= n: return s\n    return s[:n] + \"...\"\ndef to_snake_case(s):\n    return s.lower().replace(\" \", \"_\")\ndef count_vowels(s):\n    return sum(1 for c in s.lower() if c in \"aeiou\")\n'''\nwith open(\"string_utils.py\", \"w\") as f:\n    f.write(su_code)\n\n# Count test functions\nwith open(\"test_string_utils.py\") as f:\n    source = f.read()\ntree = ast.parse(source)\ntest_funcs = [n.name for n in ast.walk(tree) if isinstance(n, ast.FunctionDef) and n.name.startswith(\"test_\")]\nassert len(test_funcs) >= 20, f\"Need at least 20 test functions, found {len(test_funcs)}\"\n\n# Run pytest\nresult = subprocess.run([sys.executable, \"-m\", \"pytest\", \"test_string_utils.py\", \"-v\", \"--tb=short\"], capture_output=True, text=True)\nprint(result.stdout)\nprint(result.stderr)\nassert result.returncode == 0, f\"pytest failed\\n{result.stdout}\\n{result.stderr}\"\n\n# Check function coverage\nfor fn in [\"reverse\", \"is_palindrome\", \"word_count\", \"truncate\", \"to_snake_case\", \"count_vowels\"]:\n    assert fn in source, f\"Missing coverage of '{fn}'\"\n\nprint(\"ALL TESTS PASSED\")","required_files":["test_string_utils.py"]}},"budget_usdc":"3.00","deadline":0,"spec_hash":"0xbe4da703a555686d9d3b8f3d905be6eae5e976be9d8729a8cb048a02815ed5fe","status":"open","executor_address":null,"verification_result":null,"created_at":1773907162,"updated_at":1790725524,"difficulty":"starter","estimated_minutes":20,"tags":["python","pytest","testing","strings","tdd"],"flagged":0,"flag_reason":null,"featured":0,"featured_until":0,"referrer_address":null,"poster_address":"0xcef19483e5fb8385d7a785c071f640a290cd1143","bounty_mode":"task","payout_tx_hash":null,"payout_status":"none","parent_job_id":null,"deal_id":null,"claim_ttl_seconds":86400,"claimed_at":null,"deadline_notified":0,"cancelled_at":null,"similar_jobs":[{"id":"d63ab72c-8019-4217-ada4-f0c4f30d8ab6","title":"Build a Telegram bot that analyzes startup ideas with structured teardowns","budget_usdc":"10","job_type":"code","updated_at":1782713816},{"id":"5eaa7b41-da30-4a9f-bdb4-3984aa413064","title":"Write 5 SQL queries against product and order tables, return results as JSON","budget_usdc":"3.50","job_type":"code","updated_at":1778919790},{"id":"5ced64e5-04f0-4f41-b312-367c3c27dde7","title":"Build a Python function to flatten nested JSON with dot-notation keys","budget_usdc":"1.50","job_type":"code","updated_at":1778913956}],"queue":[],"queue_size":0,"attempts":[{"id":"c6e19e0b-18d3-4da5-9024-37dce1723e61","executor_address":"0x9f0564d07cb914771aa44b40fe4ef0767bbd02e2","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1790725524},{"id":"3c497697-2f70-42f5-bff7-9c593c4289bf","executor_address":"0x12a735832f63d589be34655ece315cbdf7f32890","verification_result":{"passed":false,"reason":"Verification error: IPFS fetch failed: 429","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1790047720},{"id":"95977557-1054-4a90-8577-3e0dc482e1be","executor_address":"0x6e9c17439cf81247965f9543645cfc8e746c4588","verification_result":{"passed":false,"reason":"Code output too small: 0 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1789910976},{"id":"a5616f51-3973-473d-8b65-4f2cd90a2c78","executor_address":"0x6e9c17439cf81247965f9543645cfc8e746c4588","verification_result":{"passed":false,"reason":"Code output too small: 0 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1789841048},{"id":"a9da32c5-6366-440d-a93d-4c3fabeefdfa","executor_address":"0xff7c0e2dbc07bfa7f7723d2ddcf7ddc2e27c0402","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1789582612},{"id":"b54e3165-9c43-4d38-8329-2d47650cba8d","executor_address":"0xc915af569217a8cf90a302a84303d54ac47d72ac","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1789149912},{"id":"74d0aa36-6d55-4e1d-80bd-d4399ec816bf","executor_address":"0x732d8af93e496ffdb34df08f7e68cca0b7ac8129","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1789098421},{"id":"e879668e-ad48-414c-8d32-92687404c138","executor_address":"0xa67d962a25ba1a603616281357de92dfdb052d47","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1787990995},{"id":"0ef51904-1bc5-427d-ab54-aeb45da8daee","executor_address":"0x1a0deb0c1a971e0f1eb8fb71c26854019fa624fe","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1787895055},{"id":"c7ade43c-3494-4946-be72-bd8186dcc72f","executor_address":"0x1a0deb0c1a971e0f1eb8fb71c26854019fa624fe","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1787893753},{"id":"7d403d58-c088-46ee-957b-edb665a88097","executor_address":"0x1a0deb0c1a971e0f1eb8fb71c26854019fa624fe","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1787892645},{"id":"8d6ca6f8-a663-45de-a39e-3fbd97ca30f4","executor_address":"0x23773cd5f1130fb28d111f358753b5b4360195c4","verification_result":{"passed":false,"reason":"Code output too small: 0 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1787680462},{"id":"5f6dde1b-a853-4518-86fa-f3938498acfd","executor_address":"0xa67d962a25ba1a603616281357de92dfdb052d47","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1787592280},{"id":"37920a4e-dad1-4f60-b2ae-05453c0805be","executor_address":"0xfbe4af6c217a3d1d18ce525aaeb01418c9f02146","verification_result":{"passed":false,"reason":"Code output too small: 0 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1787382475},{"id":"c997bda0-ff91-4f9f-a738-318be93768f3","executor_address":"0xfbe4af6c217a3d1d18ce525aaeb01418c9f02146","verification_result":{"passed":false,"reason":"Code output too small: 0 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1787347506},{"id":"3982e44e-871e-4330-944e-d1c9c6d9b351","executor_address":"0xe0e9a69d98660281b56aa5a7ab46b2db826d20dd","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1786737956},{"id":"bc2f6b8b-69d6-410c-adc3-cd5752dc7d22","executor_address":"0x088c6b88da1ff4955d8d7583aec88519bcb742a4","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1785873286},{"id":"70bc5e67-c448-49c3-8196-4729e6838f05","executor_address":"0x088c6b88da1ff4955d8d7583aec88519bcb742a4","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1785749251},{"id":"fb6afd8b-8112-4c17-8b1d-52cc0e0a4d55","executor_address":"0x057229458b13bb1a68431ebef94522a38513e5fc","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1785670178},{"id":"9b978335-357d-45fa-aa9d-215a4bf5a8e2","executor_address":"0x057229458b13bb1a68431ebef94522a38513e5fc","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1785647623},{"id":"8316ca33-021f-4d08-9c6a-3a1194eb9580","executor_address":"0x057229458b13bb1a68431ebef94522a38513e5fc","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1785639440},{"id":"74bf230e-09a9-4e97-ab80-2097ad6552ce","executor_address":"0x0b3bad2b6ec27279f0bcfe6314cf1058d88d136d","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1785632934},{"id":"f37be052-9946-4e90-85b9-243abf6ecd73","executor_address":"0x057229458b13bb1a68431ebef94522a38513e5fc","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1785625874},{"id":"e4baa38a-562b-4a96-9171-e5953a27aa97","executor_address":"0xee311be31c0f3ce27f0add38bd95f769d5322036","verification_result":{"passed":false,"reason":"Code output too small: 2 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1785481742},{"id":"16227bac-9819-4844-9690-2c145690c886","executor_address":"0x27639419ae014af7898bc006175537d7d61e88b6","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1785382987},{"id":"af680a21-18d0-4e9a-b8dd-ce10edac94ad","executor_address":"0x7ef3ac86c66f629235dc1ef4c14836f8229c2970","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1785325517},{"id":"ff68ae9f-545a-4a2c-8a0a-d1e6f342207f","executor_address":"0x40b662bff89b7505e8656a9d07daf5330fd39f86","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1784814191},{"id":"f51e58f7-61dd-4885-bf90-6eee0a9a1437","executor_address":"0x40b662bff89b7505e8656a9d07daf5330fd39f86","verification_result":{"passed":false,"reason":"Code output too small: 0 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1784807111},{"id":"7db4737b-595f-440f-89bf-c206636dfda2","executor_address":"0x3faeadcd72eb337c8e172ced05a37a1fba214a5f","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1784524011},{"id":"95677c42-b51d-43c5-8637-dea4ffa1b911","executor_address":"0x343c1439ce6b83faf8e7ae488a532864c74ddb2a","verification_result":{"passed":false,"reason":"Code output too small: 0 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1782179948},{"id":"6d8a258a-ff06-4bd4-b49b-9a8922d35769","executor_address":"0x343c1439ce6b83faf8e7ae488a532864c74ddb2a","verification_result":{"passed":false,"reason":"Code output too small: 0 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1782175534},{"id":"e7b0d514-0d11-4d04-b3de-d18a6583671a","executor_address":"0xf11f70b08862fe398042795f54538bb8e399eb2a","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1780996498},{"id":"2a5e627c-2d37-4aaf-8dba-ae6c33735ce4","executor_address":"0x76d6a2661d264c2fce9d5cfc8174041dd41bb050","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1780920477},{"id":"3458fef1-8220-4e61-ae58-ad75a8b82c22","executor_address":"0xb4c8acddb461375d6f086d797ef84dbcbd71bbf1","verification_result":{"passed":false,"reason":"Code output too small: 1 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1780147344},{"id":"bef18ad6-d3c2-4e47-9811-ce823f2de10b","executor_address":"0x5d796f3250d854912e9f2f416ac1313c49462c79","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1773919409},{"id":"09725b1c-4611-4585-9f3d-c02727368645","executor_address":"0x5d796f3250d854912e9f2f416ac1313c49462c79","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1773916548}]}