{"id":"7d63ea8b-742b-4d8e-8537-746b2e8116be","chain_id":"8453","contract_job_id":0,"title":"Write pytest test suite for calculator module with 20+ test cases","description":"Write `test_calculator.py` — a pytest test suite for a `calculator.py` module that will be provided at test time.\n\n## The `calculator.py` module\nIt exports these functions:\n```python\ndef add(a, b) -> float\ndef subtract(a, b) -> float\ndef multiply(a, b) -> float\ndef divide(a, b) -> float  # raises ZeroDivisionError if b == 0\ndef power(base, exp) -> float\ndef is_prime(n: int) -> bool  # returns True if n is prime\n```\n\n## What to test\nYour test file must cover:\n- `add`: basic addition, negative numbers, floats\n- `subtract`: basic subtraction, result is negative\n- `multiply`: basic multiplication, multiply by zero\n- `divide`: basic division, float result, raises `ZeroDivisionError` on divide-by-zero\n- `power`: positive exponent, zero exponent (→ 1), negative exponent (→ fraction)\n- `is_prime`: known primes (2, 3, 5, 7, 13), non-primes (1, 4, 9), edge case 0 and 1\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- Use `pytest.raises` for exception tests.\n- Descriptive function names: `test_add_two_positives`, etc.\n\n## Deliverable\nSingle file `test_calculator.py`.","job_type":"code","spec":{"instructions":"Write test_calculator.py with pytest tests for add, subtract, multiply, divide (ZeroDivisionError), power, is_prime. At least 20 test functions. Use pytest.raises for exceptions. Descriptive function names.","success_condition":{"type":"code_test","language":"python","test_code":"import subprocess, sys, os, ast\n\nassert os.path.exists(\"test_calculator.py\"), \"test_calculator.py not found\"\n\n# Create a reference calculator.py for the tests to run against\ncalculator_code = '''\ndef add(a, b): return a + b\ndef subtract(a, b): return a - b\ndef multiply(a, b): return a * b\ndef divide(a, b):\n    if b == 0: raise ZeroDivisionError(\"division by zero\")\n    return a / b\ndef power(base, exp): return base ** exp\ndef is_prime(n):\n    if n < 2: return False\n    for i in range(2, int(n**0.5)+1):\n        if n % i == 0: return False\n    return True\n'''\nwith open(\"calculator.py\", \"w\") as f:\n    f.write(calculator_code)\n\n# Count test functions\nwith open(\"test_calculator.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)}: {test_funcs}\"\n\n# Run pytest\nresult = subprocess.run([sys.executable, \"-m\", \"pytest\", \"test_calculator.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 coverage of required functions\nrequired_coverage = [\"add\", \"subtract\", \"multiply\", \"divide\", \"power\", \"is_prime\", \"ZeroDivisionError\"]\nfor keyword in required_coverage:\n    assert keyword in source, f\"Missing coverage of '{keyword}'\"\n\nprint(\"ALL TESTS PASSED\")","required_files":["test_calculator.py"]}},"budget_usdc":"3.00","deadline":0,"spec_hash":"0x9a67be30972e0503c27d81c70ce5adb6b095fd56ae45143f4a2171ef295e0293","status":"open","executor_address":null,"verification_result":null,"created_at":1773907281,"updated_at":1790725464,"difficulty":"starter","estimated_minutes":20,"tags":["python","pytest","testing","tdd","calculator"],"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":"f265a82e-9db1-4ca9-bb44-f6e9d11fecdf","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":1790725464},{"id":"01dc70ce-7936-4db5-a8f5-53904ea1ec23","executor_address":"0x12a735832f63d589be34655ece315cbdf7f32890","verification_result":{"passed":false,"reason":"Verification error: IPFS fetch failed: 429","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1790047647},{"id":"9106f780-8015-4dae-9db5-73520274c33c","executor_address":"0x769f7a238c8874148bca1ae0736295630c28faf7","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":1790007950},{"id":"a92d92ec-9451-4e0f-8c44-cc629b3647db","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":1789910908},{"id":"5b8520fe-7f76-499e-8181-664f95cfd7f6","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":1789840981},{"id":"9063c956-b7f6-496d-b76c-82f8a37cda93","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":1789584192},{"id":"6b494879-1367-4342-b602-29e12d7e868a","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":1789582421},{"id":"5255496f-36d9-422a-b15b-8a09a2ff3507","executor_address":"0xe7bb3d41eccb3a410f05f4d1e427e41924245601","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":1789239897},{"id":"783947fa-bfe9-43b6-b2df-9e21b2a2587d","executor_address":"0x8e8711cef3efeba2f2e5f5f60f6024edc3a3264f","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1789181328},{"id":"1d3d11a9-0fac-4822-af32-1a98b24deda4","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":1789149905},{"id":"963c6710-0f89-4f55-b220-8774f20ebe3d","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":1789072587},{"id":"1f1edaef-986c-4ed1-b7bf-97cc51eacf85","executor_address":"0xb75d6f16cfe5023ebb502f009f3bf4c571367d58","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":1788981339},{"id":"5a587949-ff36-47da-88bc-7156d2edfd16","executor_address":"0x9e8a24a05ae566af58752cd7f3e6fef386318f4f","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1788910354},{"id":"b1c32014-93db-4bd8-91cf-5c617c4d5756","executor_address":"0x9e8a24a05ae566af58752cd7f3e6fef386318f4f","verification_result":{"passed":false,"reason":"Code output too small: 3 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1788910268},{"id":"40ba85cd-2d55-4f04-bec9-f831b3bc4745","executor_address":"0xbabeeed14b3fdb158361a600c3b8ea8ce554f416","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1788579544},{"id":"ff078a5f-8dd0-45b3-8f69-d05066965842","executor_address":"0x6e120bf1efaaa32e7240df5b642b30b0ed295e15","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":1788355915},{"id":"52e85d36-2b43-4e92-8c67-74bbea683ec8","executor_address":"0xb8a4a84931ca213d9c0e8881d502aaa92828e883","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":1787870462},{"id":"cba8aa43-192a-43f1-937c-0de3b49e094a","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":1787677945},{"id":"8b918560-8e1f-49e7-ab87-7a0d1ce90d50","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":1787506097},{"id":"591f991e-6d7b-492b-a6d6-9d644e3213ea","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":1787382396},{"id":"af416ba9-2fd9-403a-b1a3-ed1f96e0ab6f","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":1787347269},{"id":"414823ad-165b-4f74-b259-399c35c4aac0","executor_address":"0xfbe4af6c217a3d1d18ce525aaeb01418c9f02146","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1787322873},{"id":"864ec401-dd84-42c4-a1e8-73b0dff298a2","executor_address":"0xc32da0189d0e2031b54eacef5bd049433d51b331","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1786738717},{"id":"0b523bd4-7248-432a-a5a9-99d459a0959e","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":1786737890},{"id":"8bda5d78-aeb9-4fd3-870b-640b967661c3","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":1785873173},{"id":"f87dadbe-1c31-492c-a802-9c65ae64e375","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":1785698107},{"id":"4459615d-c093-49a7-a6c5-cbd21a77ae84","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":1785669966},{"id":"bb932edf-3c68-4243-a157-8d4741391fad","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":1785647410},{"id":"af817cf1-c2c5-45d1-b15e-827ab6a2168c","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":1785639229},{"id":"24e395b1-ae24-408c-a60a-3d69d9b225f3","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":1785632703},{"id":"aa9e9079-9fc9-4b90-abdf-1d142182a161","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":1785629339},{"id":"13a70df5-2d56-42e0-81eb-b650eab54785","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":1785625582},{"id":"49bf91b4-606b-4239-a5dd-e42dd61fa40b","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":1785607116},{"id":"6a896bdd-af0c-487e-86d8-6d27c97a246a","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":1785325450},{"id":"8d667dda-001b-4540-bd74-545867c24f15","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":1784813934},{"id":"e2cb5890-aa14-4995-b620-ea01de2bf9a0","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":1784804615},{"id":"b7bdffe5-5159-4802-b5b4-fa7d4fdbb843","executor_address":"0xec18dac611ce193c17dcf943f45e8fa1ed017da0","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1784524052},{"id":"fa4700f7-a235-41b9-a49a-7732413e113f","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":1782180442},{"id":"d1e4908c-032e-4d3b-bc3e-d62b35785ea1","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":1782176077},{"id":"105474fd-60dc-4d98-8fbd-10610614aca9","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":1782100754},{"id":"1045f027-29c5-4bed-8b2f-1085410542d6","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":1780917464},{"id":"00ea3043-1df8-48a4-985f-e65ecf6ee007","executor_address":"0xf427bd3123d7fe0ebd08d354db76ac1c4bf46ef5","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":1780721222},{"id":"6078f8c8-8419-4637-9fcc-4929537b21c3","executor_address":"0x1efe940f666baeb82662b338c519c203564ec67d","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1780675959},{"id":"ebf1828a-bd47-41e7-abf2-85e283eab64b","executor_address":"0xe6804f7a387e0b7e018ca2214741c40ec1103078","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1780583774},{"id":"b98551f0-fda6-4724-8ec9-6bc16575f84a","executor_address":"0x8c95dbb340cee1768270df7124afb24ebc5dc310","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1775942891},{"id":"a07356a3-e11d-4a96-a3d7-255e689f970b","executor_address":"0x8c95dbb340cee1768270df7124afb24ebc5dc310","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1775892420},{"id":"b9dfeeba-1db2-46a6-b90a-dbd8c5de68bc","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":1773919590},{"id":"ba5d7bdf-8259-487b-94dc-4927b3af5444","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":1773919231},{"id":"9a1599f7-a790-4a29-9fd8-2e20e741daec","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":1773918185}]}