| { |
| "version": 1, |
| "cases": [ |
| { |
| "id": "dedupe-stable", |
| "prompt": "Write Python defining dedupe(items) that returns a new list with duplicates removed in first-seen order. Items are hashable. Return code only, under 768 tokens.", |
| "tests": "assert dedupe([]) == []\nassert dedupe([3,1,3,2,1]) == [3,1,2]\nassert dedupe(['a','a','b']) == ['a','b']\nx=[1,2,1]; y=dedupe(x); assert x == [1,2,1] and y is not x" |
| }, |
| { |
| "id": "chunked-strict", |
| "prompt": "Write Python defining chunked(items, size) returning a list of lists. Reject bool/non-int/non-positive size with ValueError; do not mutate input. Return code only, under 768 tokens.", |
| "tests": "assert chunked([1,2,3,4,5],2)==[[1,2],[3,4],[5]]\nassert chunked([],3)==[]\nfor bad in (0,-1,True,1.5):\n try: chunked([1],bad)\n except ValueError: pass\n else: raise AssertionError(bad)\nx=[1,2]; chunked(x,1)[0][0]=9; assert x==[1,2]" |
| }, |
| { |
| "id": "deep-get", |
| "prompt": "Write Python defining deep_get(mapping, path, default=None). path is a dot-separated string; traverse mappings only, preserve present None, return default for missing/non-mapping nodes, and reject empty path with ValueError. Return code only, under 768 tokens.", |
| "tests": "d={'a':{'b':None},'x':3}\nassert deep_get(d,'a.b','z') is None\nassert deep_get(d,'a.c','z')=='z'\nassert deep_get(d,'x.y',7)==7\ntry: deep_get(d,'')\nexcept ValueError: pass\nelse: raise AssertionError('empty path')" |
| } |
| ] |
| } |
|
|