MutaFix run: more-itertools-011
ranker nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B · patcher nvidia/nemotron-3-super-120b-a12b · via Nebius Token Factory
- if not (k not in seen_list): (injected bug)+ if k not in seen_list: (original)retriever rank 1 of 20 · ranker position 1 · patched the right function yes · exact restore yes
Trace
failing tests and errors
tests/test_more.py::ClassifyUniqueTests::test_key_non_hashable tests/test_more.py::ClassifyUniqueTests::test_key_partially_hashable tests/test_more.py::ClassifyUniqueTests::test_non_hashable tests/test_more.py::ClassifyUniqueTests::test_partially_hashabletests/test_more.py::ClassifyUniqueTests::test_key_non_hashable
E AssertionError: Lists differ: [([1, 2], True, False), ([3, 0], True, False), ([5, -2], [54 chars]lse)] != [([1, 2], True, True), ([3, 0], True, True), ([5, -2], Tr[50 chars]lse)] E E First differing element 0: E ([1, 2], True, False) E ([1, 2], True, True) E E - [([1, 2], True, False), E ? ^^^^ E E + [([1, 2], True, True), E ? ^^^ E E - ([3, 0], True, False), E ? ^^^^ Etests/test_more.py::ClassifyUniqueTests::test_key_partially_hashable
E AssertionError: Lists differ: [([1, 2], True, False), ((1, 2), True, True), ([1, 2], Tr[52 chars]lse)] != [([1, 2], True, True), ((1, 2), True, True), ([1, 2], Tru[50 chars]lse)] E E First differing element 0: E ([1, 2], True, False) E ([1, 2], True, True) E E - [([1, 2], True, False), E ? ^^^^ E E + [([1, 2], True, True), E ? ^^^ E E ((1, 2), True, True), E ([1, 2], True, False), E - ([5, 6], True, False),
tests/test_more.py::ClassifyUniqueTests::test_key_non_hashable in the static call graph. Kept 20 candidates, ranked by spectrum score (Ochiai), call graph and BM25 break ties.candidates in retriever order
more_itertools/more.py::classify_uniquemore_itertools/more.py::all_uniquemore_itertools/recipes.py::unique_everseenmore_itertools/more.py::is_sortedmore_itertools/recipes.py::uniquemore_itertools/more.py::duplicates_everseenmore_itertools/more.py::unique_in_windowmore_itertools/more.py::distinct_combinationsmore_itertools/more.py::combination_with_replacement_indexmore_itertools/recipes.py::all_equalmore_itertools/more.py::substringsmore_itertools/more.py::unique_to_eachmore_itertools/more.py::duplicates_justseenmore_itertools/recipes.py::unique_justseenmore_itertools/recipes.py::iter_exceptmore_itertools/more.py::chunked_evenmore_itertools/more.py::join_mappingsmore_itertools/more.py::_sample_weightedmore_itertools/more.py::combination_indexmore_itertools/more.py::permutation_index
more_itertools/more.py::classify_uniquemore_itertools/more.py::all_uniquemore_itertools/recipes.py::unique_everseenmore_itertools/more.py::is_sortedmore_itertools/recipes.py::unique
read more_itertools/more.py::classify_unique
The failing tests indicate that the third tuple element (is_unique_everseen) is incorrectly reported as False when it should be True for first occurrences. The classify_unique function's logic for tracking ever-unique elements appears to have a bug in the exception handling path where it uses seen_list instead of properly initializing is_unique_everseen.
The bug is in the exception handler condition. The original code uses `if not (k not in seen_list)` which incorrectly sets is_unique_everseen = True only when k IS in seen_list (i.e., when it's a duplicate). This causes first occurrences of unhashable items to be marked as not ever-unique. The fix removes the `not` so that is_unique_everseen = True when k is NOT in seen_list (i.e., when it's a new element).
--- a/more_itertools/more.py+++ b/more_itertools/more.py@@ -4851,5 +4851,5 @@ is_unique_everseen = True except TypeError:- if not (k not in seen_list):+ if k not in seen_list: seen_list.append(k) is_unique_everseen = True
tests: all tests pass
Final patch
--- a/more_itertools/more.py+++ b/more_itertools/more.py@@ -4851,5 +4851,5 @@ is_unique_everseen = True except TypeError:- if not (k not in seen_list):+ if k not in seen_list: seen_list.append(k) is_unique_everseen = True