MutaFix run: more-itertools-009

ranker nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B · patcher nvidia/nemotron-3-super-120b-a12b · via Nebius Token Factory

fixedoutcome
33swall time
1model calls
$0.0002API cost
Benchmark ground truth (hidden from the agent)
more_itertools/more.py:244 · operator NEGCOND · function more_itertools/more.py::chunked.<locals>.ret
- if not (len(chunk) != n):   (injected bug)+ if len(chunk) != n:   (original)
retriever rank 1 of 20 · ranker position 1 · patched the right function yes · exact restore yes

Trace

reproduce
+12.64s
1 failing test(s) · 1 failed, 767 passed · 12.64s
failing tests and errors
tests/test_more.py::ChunkedTests::test_strict_being_true
tests/test_more.py::ChunkedTests::test_strict_being_true
E   ValueError: iterable is not divisible by n.
trace
+18.2s
re-ran 1 test file(s) with the trace plugin: 1 failing and 619 passing tests, 3 library functions ran in a failing test · 5.46s
tests/test_more.py
retrieve
+18.2s
280 functions indexed, 3 reachable from tests/test_more.py::ChunkedTests::test_strict_being_true in the static call graph. Kept 20 candidates, ranked by spectrum score (Ochiai), call graph and BM25 break ties.
candidates in retriever order
  1. more_itertools/more.py::chunked.<locals>.ret call depth 1 · Ochiai 1.00 (failing 1, passing 0)
  2. more_itertools/more.py::chunked call depth 1 · Ochiai 0.33 (failing 1, passing 8)
  3. more_itertools/recipes.py::take call depth 2 · Ochiai 0.16 (failing 1, passing 38)
  4. more_itertools/more.py::divide call depth - · Ochiai 0.00 (failing 0, passing 3)
  5. more_itertools/more.py::sliced call depth - · Ochiai 0.00 (failing 0, passing 6)
  6. more_itertools/recipes.py::grouper call depth - · Ochiai 0.00 (failing 0, passing 0)
  7. more_itertools/recipes.py::_batched call depth - · Ochiai 0.00 (failing 0, passing 3)
  8. more_itertools/more.py::distribute call depth - · Ochiai 0.00 (failing 0, passing 3)
  9. more_itertools/more.py::filter_except call depth - · Ochiai 0.00 (failing 0, passing 5)
  10. more_itertools/more.py::zip_offset call depth - · Ochiai 0.00 (failing 0, passing 6)
  11. more_itertools/more.py::strictly_n call depth - · Ochiai 0.00 (failing 0, passing 5)
  12. more_itertools/more.py::map_except call depth - · Ochiai 0.00 (failing 0, passing 4)
  13. more_itertools/more.py::split_into call depth - · Ochiai 0.00 (failing 0, passing 16)
  14. more_itertools/more.py::only call depth - · Ochiai 0.00 (failing 0, passing 6)
  15. more_itertools/more.py::interleave_evenly call depth - · Ochiai 0.00 (failing 0, passing 11)
  16. more_itertools/more.py::one call depth - · Ochiai 0.00 (failing 0, passing 6)
  17. more_itertools/more.py::extract call depth - · Ochiai 0.00 (failing 0, passing 7)
  18. more_itertools/more.py::sliced.<locals>.ret call depth - · Ochiai 0.00 (failing 0, passing 1)
  19. more_itertools/recipes.py::triplewise call depth - · Ochiai 0.00 (failing 0, passing 0)
  20. more_itertools/more.py::iequals call depth - · Ochiai 0.00 (failing 0, passing 9)
rank
+18.2s
spectrum order kept (no model call)
  1. more_itertools/more.py::chunked.<locals>.ret
  2. more_itertools/more.py::chunked
  3. more_itertools/recipes.py::take
  4. more_itertools/more.py::divide
  5. more_itertools/more.py::sliced
patch
+33.03s
turn 1 · NVIDIA-Nemotron-3-Nano-30B-A3B · 3287 in / 151 out · 2.77s · $0.00023

The condition in ret() incorrectly checks `len(chunk) != n` and then negates it with `not`. This means it raises an error when the chunk length IS equal to n, which is the opposite of the intended behavior. The test expects a ValueError when the iterable is not divisible by n (i.e., when a chunk has length != n). The condition should simply check `len(chunk) != n` and raise the error in that case.

--- a/more_itertools/more.py+++ b/more_itertools/more.py@@ -242,5 +242,5 @@         def ret():             for chunk in iterator:-                if not (len(chunk) != n):+                if len(chunk) != n:                     raise ValueError('iterable is not divisible by n.')                 yield chunk

tests: all tests pass 768 passed

Final patch

--- a/more_itertools/more.py+++ b/more_itertools/more.py@@ -242,5 +242,5 @@         def ret():             for chunk in iterator:-                if not (len(chunk) != n):+                if len(chunk) != n:                     raise ValueError('iterable is not divisible by n.')                 yield chunk