{"instance_id": "click_3004", "repo": "pallets/click", "base_commit": "a1235aacb1be55dc66ddcfefbf64dec44b6ab54d", "patch": "diff --git a/CHANGES.rst b/CHANGES.rst\nindex efa23d3..e0f7037 100644\n--- a/CHANGES.rst\n+++ b/CHANGES.rst\n@@ -8,9 +8,12 @@ Unreleased\n - Fix reconciliation of `default`, `flag_value` and `type` parameters for\n flag options, as well as parsing and normalization of environment variables.\n :issue:`2952` :pr:`2956`\n+- Use the value of ``Enum`` choices to render their default value in help\n+ screen. Refs :issue:`2911` :pr:`3004`\n - Fix completion for the Z shell (``zsh``) for completion items containing\n colons. :issue:`2703` :pr:`2846`\n \n+\n Version 8.2.1\n -------------\n \ndiff --git a/src/click/core.py b/src/click/core.py\nindex 445460b..4bebb77 100644\n--- a/src/click/core.py\n+++ b/src/click/core.py\n@@ -2872,6 +2872,8 @@ class Option(Parameter):\n default_string = f\"({self.show_default})\"\n elif isinstance(default_value, (list, tuple)):\n default_string = \", \".join(str(d) for d in default_value)\n+ elif isinstance(default_value, enum.Enum):\n+ default_string = default_value.name\n elif inspect.isfunction(default_value):\n default_string = _(\"(dynamic)\")\n elif self.is_bool_flag and self.secondary_opts:\n", "test_patch": "diff --git a/tests/test_options.py b/tests/test_options.py\nindex f501738..1e7826d 100644\n--- a/tests/test_options.py\n+++ b/tests/test_options.py\n@@ -1,5 +1,10 @@\n+import enum\n import os\n import re\n+import sys\n+\n+if sys.version_info < (3, 11):\n+ enum.StrEnum = enum.Enum # type: ignore[assignment]\n \n import pytest\n \n@@ -1300,6 +1305,33 @@ def test_non_flag_with_non_negatable_default(runner):\n assert result.exit_code == 0\n \n \n+class HashType(enum.Enum):\n+ MD5 = enum.auto()\n+ SHA1 = enum.auto()\n+\n+\n+class Number(enum.IntEnum):\n+ ONE = enum.auto()\n+ TWO = enum.auto()\n+\n+\n+class Letter(enum.StrEnum):\n+ A = enum.auto()\n+ B = enum.auto()\n+\n+\n+class Color(enum.Flag):\n+ RED = enum.auto()\n+ GREEN = enum.auto()\n+ BLUE = enum.auto()\n+\n+\n+class ColorInt(enum.IntFlag):\n+ RED = enum.auto()\n+ GREEN = enum.auto()\n+ BLUE = enum.auto()\n+\n+\n @pytest.mark.parametrize(\n (\"choices\", \"metavars\"),\n [\n@@ -1308,6 +1340,11 @@ def test_non_flag_with_non_negatable_default(runner):\n pytest.param([1.0, 2.0], \"[FLOAT]\", id=\"float choices\"),\n pytest.param([True, False], \"[BOOLEAN]\", id=\"bool choices\"),\n pytest.param([\"foo\", 1], \"[TEXT|INTEGER]\", id=\"text/int choices\"),\n+ pytest.param(HashType, \"[HASHTYPE]\", id=\"enum choices\"),\n+ pytest.param(Number, \"[NUMBER]\", id=\"int enum choices\"),\n+ pytest.param(Letter, \"[LETTER]\", id=\"str enum choices\"),\n+ pytest.param(Color, \"[COLOR]\", id=\"flag enum choices\"),\n+ pytest.param(ColorInt, \"[COLORINT]\", id=\"int flag enum choices\"),\n ],\n )\n def test_usage_show_choices(runner, choices, metavars):\n@@ -1330,12 +1367,61 @@ def test_usage_show_choices(runner, choices, metavars):\n pass\n \n result = runner.invoke(cli_with_choices, [\"--help\"])\n- assert f\"[{'|'.join([str(i) for i in choices])}]\" in result.output\n+ assert (\n+ f\"[{'|'.join(i.name if isinstance(i, enum.Enum) else str(i) for i in choices)}]\"\n+ in result.output\n+ )\n \n result = runner.invoke(cli_without_choices, [\"--help\"])\n assert metavars in result.output\n \n \n+@pytest.mark.parametrize(\n+ (\"choices\", \"default\", \"default_string\"),\n+ [\n+ ([\"foo\", \"bar\"], \"bar\", \"bar\"),\n+ # The default value is not enforced to be in the choices.\n+ ([\"foo\", \"bar\"], \"random\", \"random\"),\n+ # None cannot be a default value as-is: it left the default value as unset.\n+ ([\"foo\", \"bar\"], None, None),\n+ ([0, 1], 0, \"0\"),\n+ # Values are not coerced to the type of the choice, even if equivalent.\n+ ([0, 1], 0.0, \"0.0\"),\n+ ([1, 2], 2, \"2\"),\n+ ([1.0, 2.0], 2, \"2\"),\n+ ([1.0, 2.0], 2.0, \"2.0\"),\n+ ([True, False], True, \"True\"),\n+ ([True, False], False, \"False\"),\n+ ([\"foo\", 1], \"foo\", \"foo\"),\n+ ([\"foo\", 1], 1, \"1\"),\n+ # Enum choices are rendered as their names.\n+ # See: https://github.com/pallets/click/issues/2911\n+ (HashType, HashType.SHA1, \"SHA1\"),\n+ # Enum choices allow defaults strings that are their names.\n+ (HashType, \"SHA1\", \"SHA1\"),\n+ (Number, Number.TWO, \"TWO\"),\n+ (Letter, Letter.B, \"B\"),\n+ (Color, Color.GREEN, \"GREEN\"),\n+ (ColorInt, ColorInt.GREEN, \"GREEN\"),\n+ ],\n+)\n+def test_choice_default_rendering(runner, choices, default, default_string):\n+ @click.command()\n+ @click.option(\"-g\", type=click.Choice(choices), default=default, show_default=True)\n+ def cli_with_choices(g):\n+ pass\n+\n+ # Check that the default value is kept normalized to the type of the choice.\n+ assert cli_with_choices.params[0].default == default\n+\n+ result = runner.invoke(cli_with_choices, [\"--help\"])\n+ extra_usage = f\"[default: {default_string}]\"\n+ if default_string is None:\n+ assert extra_usage not in result.output\n+ else:\n+ assert extra_usage in result.output\n+\n+\n @pytest.mark.parametrize(\n \"opts_one,opts_two\",\n [\n", "problem_statement": "`Choice` prefers `Enum.name` even for `StrEnum` where it should use the value\nConsider the following code:\n\n```python\nfrom enum import Enum\nimport click\n\n\nclass Color(str, Enum):\n RED = \"red\"\n GREEN = \"green\"\n BLUE = \"blue\"\n\n def __str__(self) -> str:\n return self.value\n\n\n@click.command()\n@click.option(\"-C\", \"--color\", type=click.Choice(list(Color)), show_default=True)\ndef main(color: Color) -> None:\n print(repr(color))\n\n\nif __name__ == \"__main__\":\n main()\n```\n\nWith Click 8.1.8, running this script with `-C red` works as expected, but with Click 8.2.0, it instead fails with:\n\n```\nUsage: enum-choice01a.py [OPTIONS]\nTry 'enum-choice01a.py --help' for help.\n\nError: Invalid value for '-C' / '--color': 'red' is not one of 'RED', 'GREEN', 'BLUE'.\n```\n\nThis was observed with Python 3.13.3 on macOS 14.7.5.", "hints_text": "", "created_at": "2025-07-20T12:37:29Z", "FAIL_TO_PASS": ["tests.test_options::test_choice_default_rendering[Color-Color.GREEN-GREEN]", "tests.test_options::test_choice_default_rendering[ColorInt-2-GREEN]", "tests.test_options::test_choice_default_rendering[HashType-HashType.SHA1-SHA1]", "tests.test_options::test_choice_default_rendering[Letter-b-B]", "tests.test_options::test_choice_default_rendering[Number-2-TWO]"], "PASS_TO_PASS": ["tests.test_options::test_aliases_for_flags", "tests.test_options::test_argument_custom_class", "tests.test_options::test_bool_flag_auto_detection[bool flag_value]", "tests.test_options::test_bool_flag_auto_detection[bool non-flag [False]]", "tests.test_options::test_bool_flag_auto_detection[bool non-flag [None]]", "tests.test_options::test_bool_flag_auto_detection[bool non-flag [True]]", "tests.test_options::test_bool_flag_auto_detection[int option]", "tests.test_options::test_bool_flag_auto_detection[is_flag=True]", "tests.test_options::test_bool_flag_auto_detection[non-bool flag_value]", "tests.test_options::test_bool_flag_auto_detection[secondary option [implicit flag]]", "tests.test_options::test_bool_flag_with_type", "tests.test_options::test_boolean_envvar_bad_values[SHOUT-00]", "tests.test_options::test_boolean_envvar_bad_values[SHOUT-01]", "tests.test_options::test_boolean_envvar_bad_values[SHOUT-10]", "tests.test_options::test_boolean_envvar_bad_values[SHOUT-11]", "tests.test_options::test_boolean_envvar_bad_values[SHOUT-None]", "tests.test_options::test_boolean_envvar_bad_values[SHOUT-randomstring]", "tests.test_options::test_boolean_envvar_bad_values[SHOUT-tr ue]", "tests.test_options::test_boolean_envvar_normalization[ SHOUT -False-False]", "tests.test_options::test_boolean_envvar_normalization[ SHOUT -True-False]", "tests.test_options::test_boolean_envvar_normalization[NO_SHOUT-False-False]", "tests.test_options::test_boolean_envvar_normalization[NO_SHOUT-True-False]", "tests.test_options::test_boolean_envvar_normalization[RANDOM-True-False]", "tests.test_options::test_boolean_envvar_normalization[SHOUT -False-False]", "tests.test_options::test_boolean_envvar_normalization[SHOUT -True-False]", "tests.test_options::test_boolean_envvar_normalization[SHOUT- -False]", "tests.test_options::test_boolean_envvar_normalization[SHOUT- -False]", "tests.test_options::test_boolean_envvar_normalization[SHOUT- false -False]", "tests.test_options::test_boolean_envvar_normalization[SHOUT- false-False]", "tests.test_options::test_boolean_envvar_normalization[SHOUT- true -True]", "tests.test_options::test_boolean_envvar_normalization[SHOUT- true-True]", "tests.test_options::test_boolean_envvar_normalization[SHOUT--False]", "tests.test_options::test_boolean_envvar_normalization[SHOUT-0-False]", "tests.test_options::test_boolean_envvar_normalization[SHOUT-1-True]", "tests.test_options::test_boolean_envvar_normalization[SHOUT-FALSE-False]", "tests.test_options::test_boolean_envvar_normalization[SHOUT-FaLsE-False]", "tests.test_options::test_boolean_envvar_normalization[SHOUT-False-False]", "tests.test_options::test_boolean_envvar_normalization[SHOUT-None-False]", "tests.test_options::test_boolean_envvar_normalization[SHOUT-TRUE-True]", "tests.test_options::test_boolean_envvar_normalization[SHOUT-TruE-True]", "tests.test_options::test_boolean_envvar_normalization[SHOUT-True-True]", "tests.test_options::test_boolean_envvar_normalization[SHOUT-f-False]", "tests.test_options::test_boolean_envvar_normalization[SHOUT-falsE-False]", "tests.test_options::test_boolean_envvar_normalization[SHOUT-false -False]", "tests.test_options::test_boolean_envvar_normalization[SHOUT-false-False]", "tests.test_options::test_boolean_envvar_normalization[SHOUT-n-False]", "tests.test_options::test_boolean_envvar_normalization[SHOUT-no-False]", "tests.test_options::test_boolean_envvar_normalization[SHOUT-off-False]", "tests.test_options::test_boolean_envvar_normalization[SHOUT-on-True]", "tests.test_options::test_boolean_envvar_normalization[SHOUT-t-True]", "tests.test_options::test_boolean_envvar_normalization[SHOUT-truE-True]", "tests.test_options::test_boolean_envvar_normalization[SHOUT-true -True]", "tests.test_options::test_boolean_envvar_normalization[SHOUT-true-True]", "tests.test_options::test_boolean_envvar_normalization[SHOUT-y-True]", "tests.test_options::test_boolean_envvar_normalization[SHOUT-yes-True]", "tests.test_options::test_callback_validates_prompt", "tests.test_options::test_case_insensitive_choice", "tests.test_options::test_case_insensitive_choice_returned_exactly", "tests.test_options::test_choice_default_rendering[HashType-SHA1-SHA1]", "tests.test_options::test_choice_default_rendering[choices0-bar-bar]", "tests.test_options::test_choice_default_rendering[choices1-random-random]", "tests.test_options::test_choice_default_rendering[choices10-foo-foo]", "tests.test_options::test_choice_default_rendering[choices11-1-1]", "tests.test_options::test_choice_default_rendering[choices2-None-None]", "tests.test_options::test_choice_default_rendering[choices3-0-0]", "tests.test_options::test_choice_default_rendering[choices4-0.0-0.0]", "tests.test_options::test_choice_default_rendering[choices5-2-2]", "tests.test_options::test_choice_default_rendering[choices6-2-2]", "tests.test_options::test_choice_default_rendering[choices7-2.0-2.0]", "tests.test_options::test_choice_default_rendering[choices8-True-True]", "tests.test_options::test_choice_default_rendering[choices9-False-False]", "tests.test_options::test_count_default_type_help", "tests.test_options::test_counting", "tests.test_options::test_custom_validation", "tests.test_options::test_deprecated_prompt", "tests.test_options::test_deprecated_required", "tests.test_options::test_deprecated_usage[True]", "tests.test_options::test_deprecated_usage[USE B INSTEAD]", "tests.test_options::test_deprecated_warning[True]", "tests.test_options::test_deprecated_warning[USE B INSTEAD]", "tests.test_options::test_do_not_show_default_empty_multiple", "tests.test_options::test_do_not_show_no_default", "tests.test_options::test_duplicate_names_warning[opts_one0-opts_two0]", "tests.test_options::test_duplicate_names_warning[opts_one1-opts_two1]", "tests.test_options::test_dynamic_default_help_special_method", "tests.test_options::test_dynamic_default_help_text", "tests.test_options::test_dynamic_default_help_unset", "tests.test_options::test_empty_envvar[AUTO_MYPATH]", "tests.test_options::test_empty_envvar[MYPATH]", "tests.test_options::test_envvar_flag_value[ bar - bar - bar ]", "tests.test_options::test_envvar_flag_value[ bar -BAR-False]", "tests.test_options::test_envvar_flag_value[ bar -bar-False]", "tests.test_options::test_envvar_flag_value[BAR-BAR-BAR]", "tests.test_options::test_envvar_flag_value[BAR-bar-False]", "tests.test_options::test_envvar_flag_value[bar- bar -False]", "tests.test_options::test_envvar_flag_value[bar--False]", "tests.test_options::test_envvar_flag_value[bar-0-False]", "tests.test_options::test_envvar_flag_value[bar-1-bar]", "tests.test_options::test_envvar_flag_value[bar-BAR-False]", "tests.test_options::test_envvar_flag_value[bar-False-False]", "tests.test_options::test_envvar_flag_value[bar-True-bar]", "tests.test_options::test_envvar_flag_value[bar-bar random-False]", "tests.test_options::test_envvar_flag_value[bar-bar-bar]", "tests.test_options::test_envvar_flag_value[bar-f-False]", "tests.test_options::test_envvar_flag_value[bar-random bar-False]", "tests.test_options::test_envvar_flag_value[bar-random-False]", "tests.test_options::test_envvar_flag_value[bar-t-bar]", "tests.test_options::test_file_type_help_default", "tests.test_options::test_flag_duplicate_names", "tests.test_options::test_flag_value_and_default[opt_params0-False-False]", "tests.test_options::test_flag_value_and_default[opt_params1-True-True]", "tests.test_options::test_flag_value_and_default[opt_params10-False-False]", "tests.test_options::test_flag_value_and_default[opt_params11-True-True]", "tests.test_options::test_flag_value_and_default[opt_params12-False-True]", "tests.test_options::test_flag_value_and_default[opt_params13-True-True]", "tests.test_options::test_flag_value_and_default[opt_params14-False-False]", "tests.test_options::test_flag_value_and_default[opt_params15-True-True]", "tests.test_options::test_flag_value_and_default[opt_params16-False-False]", "tests.test_options::test_flag_value_and_default[opt_params17-True-True]", "tests.test_options::test_flag_value_and_default[opt_params18-False-True]", "tests.test_options::test_flag_value_and_default[opt_params19-True-True]", "tests.test_options::test_flag_value_and_default[opt_params2-False-False]", "tests.test_options::test_flag_value_and_default[opt_params20-False-False]", "tests.test_options::test_flag_value_and_default[opt_params21-True-True]", "tests.test_options::test_flag_value_and_default[opt_params22-False-foo]", "tests.test_options::test_flag_value_and_default[opt_params23-True-foo]", "tests.test_options::test_flag_value_and_default[opt_params24-False-False]", "tests.test_options::test_flag_value_and_default[opt_params25-True-True]", "tests.test_options::test_flag_value_and_default[opt_params26-False-False]", "tests.test_options::test_flag_value_and_default[opt_params27-True-True]", "tests.test_options::test_flag_value_and_default[opt_params28-False-False]", "tests.test_options::test_flag_value_and_default[opt_params29-True-False]", "tests.test_options::test_flag_value_and_default[opt_params3-True-True]", "tests.test_options::test_flag_value_and_default[opt_params30-False-False]", "tests.test_options::test_flag_value_and_default[opt_params31-True-True]", "tests.test_options::test_flag_value_and_default[opt_params32-False-False]", "tests.test_options::test_flag_value_and_default[opt_params33-True-True]", "tests.test_options::test_flag_value_and_default[opt_params34-False-False]", "tests.test_options::test_flag_value_and_default[opt_params35-True-False]", "tests.test_options::test_flag_value_and_default[opt_params36-False-False]", "tests.test_options::test_flag_value_and_default[opt_params37-True-True]", "tests.test_options::test_flag_value_and_default[opt_params38-False-False]", "tests.test_options::test_flag_value_and_default[opt_params39-True-True]", "tests.test_options::test_flag_value_and_default[opt_params4-False-False]", "tests.test_options::test_flag_value_and_default[opt_params40-False-False]", "tests.test_options::test_flag_value_and_default[opt_params41-True-False]", "tests.test_options::test_flag_value_and_default[opt_params42-False-False]", "tests.test_options::test_flag_value_and_default[opt_params43-True-foo]", "tests.test_options::test_flag_value_and_default[opt_params44-False-False]", "tests.test_options::test_flag_value_and_default[opt_params45-True-True]", "tests.test_options::test_flag_value_and_default[opt_params46-False-True]", "tests.test_options::test_flag_value_and_default[opt_params47-False-True]", "tests.test_options::test_flag_value_and_default[opt_params48-False-False]", "tests.test_options::test_flag_value_and_default[opt_params49-False-False]", "tests.test_options::test_flag_value_and_default[opt_params5-True-True]", "tests.test_options::test_flag_value_and_default[opt_params50-False-False]", "tests.test_options::test_flag_value_and_default[opt_params51-False-False]", "tests.test_options::test_flag_value_and_default[opt_params52-False-True]", "tests.test_options::test_flag_value_and_default[opt_params53-False-True]", "tests.test_options::test_flag_value_and_default[opt_params54-False-False]", "tests.test_options::test_flag_value_and_default[opt_params55-False-False]", "tests.test_options::test_flag_value_and_default[opt_params56-False-foo]", "tests.test_options::test_flag_value_and_default[opt_params57-False-foo]", "tests.test_options::test_flag_value_and_default[opt_params58-False-foo]", "tests.test_options::test_flag_value_and_default[opt_params59-False-foo]", "tests.test_options::test_flag_value_and_default[opt_params6-False-True]", "tests.test_options::test_flag_value_and_default[opt_params60-False-False]", "tests.test_options::test_flag_value_and_default[opt_params61-False-False]", "tests.test_options::test_flag_value_and_default[opt_params62-True-True]", "tests.test_options::test_flag_value_and_default[opt_params63-True-False]", "tests.test_options::test_flag_value_and_default[opt_params64-True-True]", "tests.test_options::test_flag_value_and_default[opt_params65-True-False]", "tests.test_options::test_flag_value_and_default[opt_params66-True-True]", "tests.test_options::test_flag_value_and_default[opt_params67-True-False]", "tests.test_options::test_flag_value_and_default[opt_params68-True-True]", "tests.test_options::test_flag_value_and_default[opt_params69-True-False]", "tests.test_options::test_flag_value_and_default[opt_params7-True-True]", "tests.test_options::test_flag_value_and_default[opt_params70-True-True]", "tests.test_options::test_flag_value_and_default[opt_params71-True-False]", "tests.test_options::test_flag_value_and_default[opt_params72-True-True]", "tests.test_options::test_flag_value_and_default[opt_params73-True-False]", "tests.test_options::test_flag_value_and_default[opt_params74-True-bar]", "tests.test_options::test_flag_value_and_default[opt_params75-True-foo]", "tests.test_options::test_flag_value_and_default[opt_params76-True-True]", "tests.test_options::test_flag_value_and_default[opt_params77-True-False]", "tests.test_options::test_flag_value_and_default[opt_params8-False-False]", "tests.test_options::test_flag_value_and_default[opt_params9-True-True]", "tests.test_options::test_help_option_custom_names_and_class[name_specs0- -h, --help Show this message and exit.\\n-False]", "tests.test_options::test_help_option_custom_names_and_class[name_specs0- -h, --help Show this message and exit.\\n-True]", "tests.test_options::test_help_option_custom_names_and_class[name_specs1- -h Show this message and exit.\\n --help Show this message and exit.\\n-False]", "tests.test_options::test_help_option_custom_names_and_class[name_specs1- -h Show this message and exit.\\n --help Show this message and exit.\\n-True]", "tests.test_options::test_help_option_custom_names_and_class[name_specs2- --help Show this message and exit.\\n-False]", "tests.test_options::test_help_option_custom_names_and_class[name_specs2- --help Show this message and exit.\\n-True]", "tests.test_options::test_hide_false_default_boolean_flag_value[False]", "tests.test_options::test_hide_false_default_boolean_flag_value[None]", "tests.test_options::test_init_bad_default_list[False-2-default1]", "tests.test_options::test_init_bad_default_list[True-1-1]", "tests.test_options::test_init_bad_default_list[True-2-default2]", "tests.test_options::test_init_good_default_list[False-2-default2]", "tests.test_options::test_init_good_default_list[True-1-default0]", "tests.test_options::test_init_good_default_list[True-1-default1]", "tests.test_options::test_init_good_default_list[True-2-default3]", "tests.test_options::test_init_good_default_list[True-2-default4]", "tests.test_options::test_intrange_default_help_text[type0-1<=x<=32]", "tests.test_options::test_intrange_default_help_text[type1-1=1]", "tests.test_options::test_intrange_default_help_text[type3-x<=32]", "tests.test_options::test_invalid_flag_combinations[kwargs0-'count' is not valid with 'multiple'.]", "tests.test_options::test_invalid_flag_combinations[kwargs1-'count' is not valid with 'is_flag'.]", "tests.test_options::test_invalid_flag_definition[opts0]", "tests.test_options::test_invalid_flag_definition[opts1]", "tests.test_options::test_invalid_flag_definition[opts2]", "tests.test_options::test_invalid_flag_definition[opts3]", "tests.test_options::test_invalid_nargs", "tests.test_options::test_invalid_option", "tests.test_options::test_legacy_options", "tests.test_options::test_missing_choice", "tests.test_options::test_missing_envvar", "tests.test_options::test_missing_option_string_cast", "tests.test_options::test_missing_required_flag", "tests.test_options::test_multiple_default_composite_type", "tests.test_options::test_multiple_default_help", "tests.test_options::test_multiple_default_type", "tests.test_options::test_multiple_envvar", "tests.test_options::test_multiple_option_with_optional_value", "tests.test_options::test_multiple_required", "tests.test_options::test_nargs_envvar", "tests.test_options::test_nargs_tup_composite_mult", "tests.test_options::test_non_flag_with_non_negatable_default", "tests.test_options::test_option_custom_class", "tests.test_options::test_option_custom_class_reusable", "tests.test_options::test_option_help_preserve_paragraphs", "tests.test_options::test_option_names[option_args0-aggressive]", "tests.test_options::test_option_names[option_args1-first]", "tests.test_options::test_option_names[option_args2-apple]", "tests.test_options::test_option_names[option_args3-cantaloupe]", "tests.test_options::test_option_names[option_args4-a]", "tests.test_options::test_option_names[option_args5-c]", "tests.test_options::test_option_names[option_args6-apple]", "tests.test_options::test_option_names[option_args7-cantaloupe]", "tests.test_options::test_option_names[option_args8-_from]", "tests.test_options::test_option_names[option_args9-_ret]", "tests.test_options::test_option_with_optional_value[None-expect0]", "tests.test_options::test_option_with_optional_value[args1-expect1]", "tests.test_options::test_option_with_optional_value[args10-expect10]", "tests.test_options::test_option_with_optional_value[args11-expect11]", "tests.test_options::test_option_with_optional_value[args12-expect12]", "tests.test_options::test_option_with_optional_value[args13-expect13]", "tests.test_options::test_option_with_optional_value[args2-expect2]", "tests.test_options::test_option_with_optional_value[args3-expect3]", "tests.test_options::test_option_with_optional_value[args4-expect4]", "tests.test_options::test_option_with_optional_value[args5-expect5]", "tests.test_options::test_option_with_optional_value[args6-expect6]", "tests.test_options::test_option_with_optional_value[args7-expect7]", "tests.test_options::test_option_with_optional_value[args8-expect8]", "tests.test_options::test_option_with_optional_value[args9-expect9]", "tests.test_options::test_parse_multiple_default_composite_type", "tests.test_options::test_prefixes", "tests.test_options::test_show_default_boolean_flag_name[False-no-cache]", "tests.test_options::test_show_default_boolean_flag_name[True-cache]", "tests.test_options::test_show_default_default_map", "tests.test_options::test_show_default_precedence[False-False-extra_value4-False]", "tests.test_options::test_show_default_precedence[False-None-extra_value3-False]", "tests.test_options::test_show_default_precedence[False-True-extra_value5-True]", "tests.test_options::test_show_default_precedence[False-one-extra_value9-True]", "tests.test_options::test_show_default_precedence[None-False-extra_value1-False]", "tests.test_options::test_show_default_precedence[None-None-extra_value0-False]", "tests.test_options::test_show_default_precedence[None-True-extra_value2-True]", "tests.test_options::test_show_default_precedence[True-False-extra_value7-False]", "tests.test_options::test_show_default_precedence[True-None-extra_value6-True]", "tests.test_options::test_show_default_precedence[True-True-extra_value8-True]", "tests.test_options::test_show_default_string", "tests.test_options::test_show_default_with_empty_string", "tests.test_options::test_show_envvar", "tests.test_options::test_show_envvar_auto_prefix", "tests.test_options::test_show_envvar_auto_prefix_dash_in_command", "tests.test_options::test_show_true_default_boolean_flag_value", "tests.test_options::test_suggest_possible_options[--bounds-(Possible options: --bound, --count)]", "tests.test_options::test_suggest_possible_options[--bount-(Possible options: --bound, --count)]", "tests.test_options::test_suggest_possible_options[--cat-Did you mean --count?]", "tests.test_options::test_toupper_envvar_prefix", "tests.test_options::test_type_from_flag_value", "tests.test_options::test_unknown_options[--foo]", "tests.test_options::test_unknown_options[-f]", "tests.test_options::test_usage_show_choices[bool choices]", "tests.test_options::test_usage_show_choices[enum choices]", "tests.test_options::test_usage_show_choices[flag enum choices]", "tests.test_options::test_usage_show_choices[float choices]", "tests.test_options::test_usage_show_choices[int choices]", "tests.test_options::test_usage_show_choices[int enum choices]", "tests.test_options::test_usage_show_choices[int flag enum choices]", "tests.test_options::test_usage_show_choices[str enum choices]", "tests.test_options::test_usage_show_choices[text choices]", "tests.test_options::test_usage_show_choices[text/int choices]", "tests.test_options::test_winstyle_options"], "PASS_TO_PASS_flaky": [], "FAIL_TO_PASS_dropped_validator": [], "PASS_TO_PASS_dropped_validator": [], "harness_compatible": true, "env_pinned_to_commit_date": false, "split": "overlap", "statement_source": "issue_ref", "issue_urls": ["https://github.com/pallets/click/issues/2911"], "pr_url": "https://github.com/pallets/click/pull/3004", "fix_commit": "eaf33a957975e7d0943fad8d2b4b905b6bd98cb9", "merged_at": "2025-07-22T07:30:29Z", "graph": "graphs/click_a1235aacb1be55dc66ddcfefbf64dec44b6ab54d.json", "embeddings": "embeddings/click_a1235aacb1be55dc66ddcfefbf64dec44b6ab54d.npz", "snapshot": "snapshots/click_3004.tgz", "test_patch_files": ["tests/test_options.py"], "patch_files": ["CHANGES.rst", "src/click/core.py"], "requirements": ["iniconfig==2.3.1", "packaging==26.3", "pluggy==1.7.0", "pygments==2.21.0", "pytest==9.1.1"], "build_requires": ["flit_core<4"], "localization": {"files": ["src/click/core.py"], "nodes_edited": ["click.core.Option.get_help_extra"], "nodes_added": [], "module_level": [], "aux_files": []}, "quality": {"new_api_in_tests": [], "new_api_unstated": [], "underspecified": false, "f2p_count": 5, "patch_lines": 5, "files_changed": 1, "statement_chars": 834}, "issue_created_at": "2025-05-13T11:40:30Z", "post_cutoff": true} {"instance_id": "more-itertools_1028", "repo": "more-itertools/more-itertools", "base_commit": "c834d6e4a0c4280b7b7750cb0de8dd8acb3d4c2c", "patch": "diff --git a/more_itertools/more.py b/more_itertools/more.py\nindex 3cd42e8..44ec483 100755\n--- a/more_itertools/more.py\n+++ b/more_itertools/more.py\n@@ -283,7 +283,7 @@ def last(iterable, default=_marker):\n if isinstance(iterable, Sequence):\n return iterable[-1]\n # Work around https://bugs.python.org/issue38525\n- if hasattr(iterable, '__reversed__'):\n+ if getattr(iterable, '__reversed__', None):\n return next(reversed(iterable))\n return deque(iterable, maxlen=1)[-1]\n except (IndexError, TypeError, StopIteration):\n", "test_patch": "diff --git a/tests/test_more.py b/tests/test_more.py\nindex b964312..03f6d65 100644\n--- a/tests/test_more.py\n+++ b/tests/test_more.py\n@@ -180,6 +180,16 @@ class LastTests(TestCase):\n with self.assertRaises(ValueError):\n mi.last(iterable)\n \n+ def test_reversed_is_none(self):\n+ # See https://github.com/more-itertools/more-itertools/issues/1001\n+ class ReversedIsNone:\n+ __reversed__ = None\n+\n+ def __iter__(self):\n+ return iter([1])\n+\n+ self.assertEqual(mi.last(ReversedIsNone()), 1)\n+\n \n class NthOrLastTests(TestCase):\n \"\"\"Tests for ``nth_or_last()``\"\"\"\n", "problem_statement": "last() fails if __reversed__ is None, which is the case for the Mapping abc\nUsing `last()` on this class:\n```\nfrom collections.abc import Mapping\nfrom more_itertools import last\nclass MyMapping(Mapping):\n def __getitem__(self, key):\n return 1\n def __iter__(self):\n return iter([1])\n def __len__(self):\n return 1\n\nprint(last(iter(MyMapping())))\nlast(MyMapping())\n```\n\nfails with:\n```\nTraceback (most recent call last):\n File \"/nix/store/q3zqcqwmybfda7895g91d75pzbaqj6s5-python3-3.9.20-env/lib/python3.9/site-packages/more_itertools/more.py\", line 271, in last\n return next(reversed(iterable))\nTypeError: 'MyMapping' object is not reversible\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/home/ibriquem/ws/pyshl/repro.py\", line 12, in \n last(MyMapping())\n File \"/nix/store/q3zqcqwmybfda7895g91d75pzbaqj6s5-python3-3.9.20-env/lib/python3.9/site-packages/more_itertools/more.py\", line 275, in last\n raise ValueError(\nValueError: last() was called on an empty iterable, and no default value was provided.\n```\n\nWhile it works if you first call `iter()` on the object.\n\nThis is because `__reversed__` is set to None by the Mapping base class:\nhttps://github.com/python/cpython/blob/4f28afe5456d8ed4a6fe0099337487043e29c912/Lib/_collections_abc.py#L792\n\nI'd expect it to work.\n\nMaybe [this code](https://github.com/more-itertools/more-itertools/blob/569e0ad654a85c77581b318305edc2eb7c4068ae/more_itertools/more.py#L274) could be changed from:\n```\nif hasattr(iterable, '__reversed__'):\n```\nto:\n```\nif getattr(iterable, '__reversed__', None) is not None:\n```", "hints_text": "", "created_at": "2025-07-14T00:35:41Z", "FAIL_TO_PASS": ["tests.test_more.LastTests::test_reversed_is_none"], "PASS_TO_PASS": ["tests.test_more.AdjacentTests::test_call_once", "tests.test_more.AdjacentTests::test_consecutive_true", "tests.test_more.AdjacentTests::test_distance", "tests.test_more.AdjacentTests::test_empty_iterable", "tests.test_more.AdjacentTests::test_grouping", "tests.test_more.AdjacentTests::test_large_distance", "tests.test_more.AdjacentTests::test_length_one", "tests.test_more.AdjacentTests::test_negative_distance", "tests.test_more.AdjacentTests::test_typical", "tests.test_more.AdjacentTests::test_zero_distance", "tests.test_more.AllUniqueTests::test_basic", "tests.test_more.AllUniqueTests::test_infinite", "tests.test_more.AllUniqueTests::test_key", "tests.test_more.AllUniqueTests::test_non_hashable", "tests.test_more.AllUniqueTests::test_partially_hashable", "tests.test_more.AlwaysReversibleTests::test_nonseq_reversed", "tests.test_more.AlwaysReversibleTests::test_regular_reversed", "tests.test_more.ArgMinArgMaxTests::test_basic", "tests.test_more.ArgMinArgMaxTests::test_key", "tests.test_more.BucketTests::test_basic", "tests.test_more.BucketTests::test_in", "tests.test_more.BucketTests::test_list", "tests.test_more.BucketTests::test_list_validator", "tests.test_more.BucketTests::test_validator", "tests.test_more.CallbackIterTests::test_abort", "tests.test_more.CallbackIterTests::test_basic", "tests.test_more.CallbackIterTests::test_callback_kwd", "tests.test_more.CallbackIterTests::test_exception", "tests.test_more.CallbackIterTests::test_no_result", "tests.test_more.CallbackIterTests::test_partial_consumption", "tests.test_more.ChunkedEvenTests::test_0", "tests.test_more.ChunkedEvenTests::test_1", "tests.test_more.ChunkedEvenTests::test_4", "tests.test_more.ChunkedEvenTests::test_5", "tests.test_more.ChunkedEvenTests::test_6", "tests.test_more.ChunkedEvenTests::test_7", "tests.test_more.ChunkedEvenTests::test_evenness", "tests.test_more.ChunkedEvenTests::test_infinite", "tests.test_more.ChunkedTests::test_even", "tests.test_more.ChunkedTests::test_none", "tests.test_more.ChunkedTests::test_odd", "tests.test_more.ChunkedTests::test_strict_being_true", "tests.test_more.ChunkedTests::test_strict_being_true_with_size_none", "tests.test_more.ChunkedTests::test_strict_false", "tests.test_more.CircularShiftsTests::test_duplicates", "tests.test_more.CircularShiftsTests::test_empty", "tests.test_more.CircularShiftsTests::test_simple_circular_shifts", "tests.test_more.CircularShiftsTests::test_steps_negative", "tests.test_more.CircularShiftsTests::test_steps_positive", "tests.test_more.CircularShiftsTests::test_steps_zero", "tests.test_more.ClassifyUniqueTests::test_basic", "tests.test_more.ClassifyUniqueTests::test_key_hashable", "tests.test_more.ClassifyUniqueTests::test_key_non_hashable", "tests.test_more.ClassifyUniqueTests::test_key_partially_hashable", "tests.test_more.ClassifyUniqueTests::test_non_hashable", "tests.test_more.ClassifyUniqueTests::test_partially_hashable", "tests.test_more.ClassifyUniqueTests::test_vs_duplicates_everseen", "tests.test_more.ClassifyUniqueTests::test_vs_duplicates_everseen_key", "tests.test_more.ClassifyUniqueTests::test_vs_duplicates_justseen", "tests.test_more.ClassifyUniqueTests::test_vs_duplicates_justseen_key", "tests.test_more.ClassifyUniqueTests::test_vs_unique_everseen", "tests.test_more.ClassifyUniqueTests::test_vs_unique_everseen_key", "tests.test_more.ClassifyUniqueTests::test_vs_unique_justseen", "tests.test_more.ClassifyUniqueTests::test_vs_unique_justseen_key", "tests.test_more.CombinationIndexTests::test_invalid_large", "tests.test_more.CombinationIndexTests::test_invalid_match", "tests.test_more.CombinationIndexTests::test_invalid_order", "tests.test_more.CombinationIndexTests::test_long", "tests.test_more.CombinationIndexTests::test_multiplicity", "tests.test_more.CombinationIndexTests::test_null", "tests.test_more.CombinationIndexTests::test_r_equal_to_n", "tests.test_more.CombinationIndexTests::test_r_less_than_n", "tests.test_more.CombinationWithReplacementIndexTests::test_invalid_large", "tests.test_more.CombinationWithReplacementIndexTests::test_invalid_match", "tests.test_more.CombinationWithReplacementIndexTests::test_invalid_order", "tests.test_more.CombinationWithReplacementIndexTests::test_long", "tests.test_more.CombinationWithReplacementIndexTests::test_multiplicity", "tests.test_more.CombinationWithReplacementIndexTests::test_null", "tests.test_more.CombinationWithReplacementIndexTests::test_r_equal_to_n", "tests.test_more.CombinationWithReplacementIndexTests::test_r_less_than_n", "tests.test_more.ConsecutiveGroupsTest::test_custom_ordering", "tests.test_more.ConsecutiveGroupsTest::test_exotic_ordering", "tests.test_more.ConsecutiveGroupsTest::test_numbers", "tests.test_more.ConstrainedBatchesTests::test_bad_max", "tests.test_more.ConstrainedBatchesTests::test_basic", "tests.test_more.ConstrainedBatchesTests::test_get_len", "tests.test_more.ConstrainedBatchesTests::test_max_count", "tests.test_more.ConstrainedBatchesTests::test_strict", "tests.test_more.ConsumerTests::test_consumer", "tests.test_more.CountCycleTests::test_basic", "tests.test_more.CountCycleTests::test_empty", "tests.test_more.CountCycleTests::test_negative", "tests.test_more.CountableTests::test_basic", "tests.test_more.CountableTests::test_empty", "tests.test_more.DerangementsTests::test_r", "tests.test_more.DerangementsTests::test_repeated_values", "tests.test_more.DerangementsTests::test_unique_values", "tests.test_more.DerangementsTests::test_unsortable_unhashable", "tests.test_more.DifferenceTest::test_custom", "tests.test_more.DifferenceTest::test_empty", "tests.test_more.DifferenceTest::test_initial", "tests.test_more.DifferenceTest::test_normal", "tests.test_more.DifferenceTest::test_one", "tests.test_more.DifferenceTest::test_roundtrip", "tests.test_more.DiscreteFourierTransformTests::test_basic", "tests.test_more.DiscreteFourierTransformTests::test_roundtrip", "tests.test_more.DistinctCombinationsTests::test_basic", "tests.test_more.DistinctCombinationsTests::test_empty", "tests.test_more.DistinctCombinationsTests::test_negative", "tests.test_more.DistinctPermutationsTests::test_basic", "tests.test_more.DistinctPermutationsTests::test_r", "tests.test_more.DistinctPermutationsTests::test_unhashable", "tests.test_more.DistinctPermutationsTests::test_unsortable", "tests.test_more.DistinctPermutationsTests::test_unsortable_r", "tests.test_more.DistinctPermutationsTests::test_unsorted_equivalent", "tests.test_more.DistributeTest::test_basic", "tests.test_more.DistributeTest::test_invalid_n", "tests.test_more.DistributeTest::test_large_n", "tests.test_more.DivideTest::test_basic", "tests.test_more.DivideTest::test_invalid_n", "tests.test_more.DivideTest::test_large_n", "tests.test_more.DoubleStarMapTests::test_adding", "tests.test_more.DoubleStarMapTests::test_construction", "tests.test_more.DoubleStarMapTests::test_empty", "tests.test_more.DoubleStarMapTests::test_identity", "tests.test_more.DoubleStarMapTests::test_mismatch_function_different", "tests.test_more.DoubleStarMapTests::test_mismatch_function_larger", "tests.test_more.DoubleStarMapTests::test_mismatch_function_smaller", "tests.test_more.DoubleStarMapTests::test_no_mapping", "tests.test_more.DuplicatesEverSeenTests::test_basic", "tests.test_more.DuplicatesEverSeenTests::test_key_hashable", "tests.test_more.DuplicatesEverSeenTests::test_key_non_hashable", "tests.test_more.DuplicatesEverSeenTests::test_key_partially_hashable", "tests.test_more.DuplicatesEverSeenTests::test_non_hashable", "tests.test_more.DuplicatesEverSeenTests::test_partially_hashable", "tests.test_more.DuplicatesJustSeenTests::test_basic", "tests.test_more.DuplicatesJustSeenTests::test_key_hashable", "tests.test_more.DuplicatesJustSeenTests::test_key_non_hashable", "tests.test_more.DuplicatesJustSeenTests::test_key_partially_hashable", "tests.test_more.DuplicatesJustSeenTests::test_nested", "tests.test_more.DuplicatesJustSeenTests::test_non_hashable", "tests.test_more.DuplicatesJustSeenTests::test_partially_hashable", "tests.test_more.ExactlyNTests::test_empty", "tests.test_more.ExactlyNTests::test_false", "tests.test_more.ExactlyNTests::test_true", "tests.test_more.FilterExceptTests::test_false", "tests.test_more.FilterExceptTests::test_multiple", "tests.test_more.FilterExceptTests::test_no_exceptions_pass", "tests.test_more.FilterExceptTests::test_no_exceptions_raise", "tests.test_more.FilterExceptTests::test_raise", "tests.test_more.FilterMapTests::test_filter", "tests.test_more.FilterMapTests::test_filter_map", "tests.test_more.FilterMapTests::test_map", "tests.test_more.FilterMapTests::test_no_iterables", "tests.test_more.FirstTests::test_default", "tests.test_more.FirstTests::test_empty", "tests.test_more.FirstTests::test_many", "tests.test_more.FirstTests::test_one", "tests.test_more.GrayProductTests::test_basic", "tests.test_more.GrayProductTests::test_errors", "tests.test_more.GrayProductTests::test_vs_product", "tests.test_more.GroupByTransformTests::test_default_funcs", "tests.test_more.GroupByTransformTests::test_no_valuefunc", "tests.test_more.GroupByTransformTests::test_reducefunc", "tests.test_more.GroupByTransformTests::test_valuefunc", "tests.test_more.IchunkedTests::test_even", "tests.test_more.IchunkedTests::test_laziness", "tests.test_more.IchunkedTests::test_memory_in_order", "tests.test_more.IchunkedTests::test_negative", "tests.test_more.IchunkedTests::test_odd", "tests.test_more.IchunkedTests::test_out_of_order", "tests.test_more.IchunkedTests::test_zero", "tests.test_more.IequalsTests::test_basic", "tests.test_more.IequalsTests::test_empty_iterables", "tests.test_more.IequalsTests::test_more_than_two_iterable", "tests.test_more.IequalsTests::test_no_iterables", "tests.test_more.IequalsTests::test_none_is_not_a_sentinel", "tests.test_more.IequalsTests::test_not_equal_lengths", "tests.test_more.IequalsTests::test_not_identical_but_equal", "tests.test_more.IequalsTests::test_one_iterable", "tests.test_more.IequalsTests::test_order_matters", "tests.test_more.IlenTests::test_ilen", "tests.test_more.InterleaveEvenlyTests::test_argument_mismatch_raises", "tests.test_more.InterleaveEvenlyTests::test_degenerate_empty", "tests.test_more.InterleaveEvenlyTests::test_degenerate_one", "tests.test_more.InterleaveEvenlyTests::test_equal_lengths", "tests.test_more.InterleaveEvenlyTests::test_manual_lengths", "tests.test_more.InterleaveEvenlyTests::test_many_iters", "tests.test_more.InterleaveEvenlyTests::test_no_length_raises", "tests.test_more.InterleaveEvenlyTests::test_not_proportional", "tests.test_more.InterleaveEvenlyTests::test_proportional", "tests.test_more.InterleaveEvenlyTests::test_three_iters", "tests.test_more.InterleaveLongestTests::test_even", "tests.test_more.InterleaveLongestTests::test_mixed_types", "tests.test_more.InterleaveLongestTests::test_short", "tests.test_more.InterleaveTests::test_even", "tests.test_more.InterleaveTests::test_mixed_types", "tests.test_more.InterleaveTests::test_short", "tests.test_more.IntersperseTest::test_even", "tests.test_more.IntersperseTest::test_n", "tests.test_more.IntersperseTest::test_n_zero", "tests.test_more.IntersperseTest::test_nested", "tests.test_more.IntersperseTest::test_not_iterable", "tests.test_more.IntersperseTest::test_odd", "tests.test_more.IsSortedTests::test_basic", "tests.test_more.IsliceExtendedTests::test_all", "tests.test_more.IsliceExtendedTests::test_elements_lifecycle", "tests.test_more.IsliceExtendedTests::test_invalid_slice", "tests.test_more.IsliceExtendedTests::test_slicing", "tests.test_more.IsliceExtendedTests::test_slicing_extensive", "tests.test_more.IsliceExtendedTests::test_zero_step", "tests.test_more.IterSuppressTests::test_early_suppression", "tests.test_more.IterSuppressTests::test_no_error", "tests.test_more.IterSuppressTests::test_raises_error", "tests.test_more.IterSuppressTests::test_suppression", "tests.test_more.IterateTests::test_basic", "tests.test_more.IterateTests::test_func_controls_iteration_stop", "tests.test_more.JoinMappingTests::test_basic", "tests.test_more.JoinMappingTests::test_empty", "tests.test_more.LastTests::test_basic", "tests.test_more.LastTests::test_default", "tests.test_more.LastTests::test_empty", "tests.test_more.LocateTests::test_custom_pred", "tests.test_more.LocateTests::test_default_pred", "tests.test_more.LocateTests::test_no_matches", "tests.test_more.LocateTests::test_window_size", "tests.test_more.LocateTests::test_window_size_large", "tests.test_more.LocateTests::test_window_size_zero", "tests.test_more.LongestCommonPrefixTests::test_basic", "tests.test_more.LongestCommonPrefixTests::test_contains_infinite_iterables", "tests.test_more.LongestCommonPrefixTests::test_empty_iterables_only", "tests.test_more.LongestCommonPrefixTests::test_includes_empty_iterables", "tests.test_more.LongestCommonPrefixTests::test_infinite_iterables", "tests.test_more.LongestCommonPrefixTests::test_iterators", "tests.test_more.LongestCommonPrefixTests::test_no_iterables", "tests.test_more.LongestCommonPrefixTests::test_non_hashable", "tests.test_more.LongestCommonPrefixTests::test_prefix_contains_elements_of_the_first_iterable", "tests.test_more.MakeDecoratorTests::test_basic", "tests.test_more.MakeDecoratorTests::test_result_index", "tests.test_more.MakeDecoratorTests::test_wrap_class", "tests.test_more.MapExceptTests::test_multiple", "tests.test_more.MapExceptTests::test_no_exceptions_pass", "tests.test_more.MapExceptTests::test_no_exceptions_raise", "tests.test_more.MapExceptTests::test_raise", "tests.test_more.MapIfTests::test_empty", "tests.test_more.MapIfTests::test_with_func_else", "tests.test_more.MapIfTests::test_without_func_else", "tests.test_more.MapReduceTests::test_default", "tests.test_more.MapReduceTests::test_reducefunc", "tests.test_more.MapReduceTests::test_ret", "tests.test_more.MapReduceTests::test_valuefunc", "tests.test_more.MarkEndsTests::test_basic", "tests.test_more.MinMaxTests::test_basic", "tests.test_more.MinMaxTests::test_default", "tests.test_more.MinMaxTests::test_iterables", "tests.test_more.MinMaxTests::test_key", "tests.test_more.MinMaxTests::test_unpacked", "tests.test_more.NthCombinationWithReplacementTests::test_basic", "tests.test_more.NthCombinationWithReplacementTests::test_invalid_index", "tests.test_more.NthCombinationWithReplacementTests::test_invalid_r", "tests.test_more.NthCombinationWithReplacementTests::test_long", "tests.test_more.NthOrLastTests::test_basic", "tests.test_more.NthOrLastTests::test_default_value", "tests.test_more.NthOrLastTests::test_empty_iterable_no_default", "tests.test_more.NthProductTests::test_basic", "tests.test_more.NthProductTests::test_invalid_index", "tests.test_more.NthProductTests::test_long", "tests.test_more.NthProductTests::test_negative", "tests.test_more.NumericRangeTests::test_arg_count", "tests.test_more.NumericRangeTests::test_bad_key", "tests.test_more.NumericRangeTests::test_basic", "tests.test_more.NumericRangeTests::test_bool", "tests.test_more.NumericRangeTests::test_contains", "tests.test_more.NumericRangeTests::test_count", "tests.test_more.NumericRangeTests::test_eq", "tests.test_more.NumericRangeTests::test_get_item_by_index", "tests.test_more.NumericRangeTests::test_get_item_by_slice", "tests.test_more.NumericRangeTests::test_hash", "tests.test_more.NumericRangeTests::test_index", "tests.test_more.NumericRangeTests::test_iter_twice", "tests.test_more.NumericRangeTests::test_len", "tests.test_more.NumericRangeTests::test_parent_classes", "tests.test_more.NumericRangeTests::test_pickle", "tests.test_more.NumericRangeTests::test_repr", "tests.test_more.NumericRangeTests::test_reversed", "tests.test_more.NumericRangeTests::test_zero_step", "tests.test_more.OneTests::test_basic", "tests.test_more.OneTests::test_too_long", "tests.test_more.OneTests::test_too_long_default_message", "tests.test_more.OneTests::test_too_short_new", "tests.test_more.OnlyTests::test_custom_exception", "tests.test_more.OnlyTests::test_custom_value", "tests.test_more.OnlyTests::test_default_exception_message", "tests.test_more.OnlyTests::test_defaults", "tests.test_more.OuterProductTests::test_basic", "tests.test_more.PaddedTest::test_invalid_n", "tests.test_more.PaddedTest::test_next_multiple", "tests.test_more.PaddedTest::test_no_n", "tests.test_more.PaddedTest::test_valid_n", "tests.test_more.PartialProductTests::test_basic", "tests.test_more.PartialProductTests::test_empty_iterable", "tests.test_more.PartialProductTests::test_no_iterables", "tests.test_more.PartialProductTests::test_one_iterable", "tests.test_more.PartialProductTests::test_two_iterables", "tests.test_more.PartialProductTests::test_uneven_length_iterables", "tests.test_more.PartitionsTest::test_duplicates", "tests.test_more.PartitionsTest::test_empty", "tests.test_more.PartitionsTest::test_order", "tests.test_more.PartitionsTest::test_types", "tests.test_more.PeekableTests::test_empty", "tests.test_more.PeekableTests::test_indexing", "tests.test_more.PeekableTests::test_multi_prepend", "tests.test_more.PeekableTests::test_multi_prepend_peek", "tests.test_more.PeekableTests::test_passthrough", "tests.test_more.PeekableTests::test_peek_default", "tests.test_more.PeekableTests::test_prepend", "tests.test_more.PeekableTests::test_prepend_after_stop", "tests.test_more.PeekableTests::test_prepend_indexing", "tests.test_more.PeekableTests::test_prepend_iterable", "tests.test_more.PeekableTests::test_prepend_many", "tests.test_more.PeekableTests::test_prepend_reversed", "tests.test_more.PeekableTests::test_prepend_slicing", "tests.test_more.PeekableTests::test_prepend_truthiness", "tests.test_more.PeekableTests::test_simple_peeking", "tests.test_more.PeekableTests::test_slicing", "tests.test_more.PeekableTests::test_slicing_error", "tests.test_more.PeekableTests::test_slicing_reset", "tests.test_more.PeekableTests::test_truthiness", "tests.test_more.PermutationIndexTests::test_invalid_large", "tests.test_more.PermutationIndexTests::test_invalid_match", "tests.test_more.PermutationIndexTests::test_long", "tests.test_more.PermutationIndexTests::test_multiplicity", "tests.test_more.PermutationIndexTests::test_null", "tests.test_more.PermutationIndexTests::test_r_equal_to_n", "tests.test_more.PermutationIndexTests::test_r_less_than_n", "tests.test_more.PowersetOfSetsTests::test_hash_count", "tests.test_more.PowersetOfSetsTests::test_simple", "tests.test_more.ProductIndexTests::test_basic", "tests.test_more.ProductIndexTests::test_invalid_empty", "tests.test_more.ProductIndexTests::test_invalid_large", "tests.test_more.ProductIndexTests::test_invalid_match", "tests.test_more.ProductIndexTests::test_invalid_small", "tests.test_more.ProductIndexTests::test_long", "tests.test_more.ProductIndexTests::test_multiplicity", "tests.test_more.RepeatEachTests::test_basic", "tests.test_more.RepeatEachTests::test_default", "tests.test_more.RepeatEachTests::test_empty", "tests.test_more.RepeatEachTests::test_infinite_input", "tests.test_more.RepeatEachTests::test_negative_repeat", "tests.test_more.RepeatEachTests::test_no_repeat", "tests.test_more.RepeatLastTests::test_basic", "tests.test_more.RepeatLastTests::test_default_value", "tests.test_more.RepeatLastTests::test_empty_iterable", "tests.test_more.ReplaceTests::test_basic", "tests.test_more.ReplaceTests::test_count", "tests.test_more.ReplaceTests::test_iterable_substitutes", "tests.test_more.ReplaceTests::test_window_size", "tests.test_more.ReplaceTests::test_window_size_count", "tests.test_more.ReplaceTests::test_window_size_end", "tests.test_more.ReplaceTests::test_window_size_large", "tests.test_more.ReplaceTests::test_window_size_zero", "tests.test_more.RlocateTests::test_custom_pred", "tests.test_more.RlocateTests::test_default_pred", "tests.test_more.RlocateTests::test_efficient_reversal", "tests.test_more.RlocateTests::test_no_matches", "tests.test_more.RlocateTests::test_window_size", "tests.test_more.RlocateTests::test_window_size_large", "tests.test_more.RlocateTests::test_window_size_zero", "tests.test_more.RunLengthTest::test_decode", "tests.test_more.RunLengthTest::test_encode", "tests.test_more.SampleTests::test_counts", "tests.test_more.SampleTests::test_counts_all", "tests.test_more.SampleTests::test_error_cases", "tests.test_more.SampleTests::test_invariance_under_permutations_unweighted", "tests.test_more.SampleTests::test_invariance_under_permutations_weighted", "tests.test_more.SampleTests::test_length", "tests.test_more.SampleTests::test_negative", "tests.test_more.SampleTests::test_sampling_entire_iterable", "tests.test_more.SampleTests::test_scale_invariance_of_weights", "tests.test_more.SampleTests::test_specific_sample", "tests.test_more.SampleTests::test_strict", "tests.test_more.SampleTests::test_unit_case", "tests.test_more.SeekableTest::test_elements", "tests.test_more.SeekableTest::test_exhaustion_reset", "tests.test_more.SeekableTest::test_forward", "tests.test_more.SeekableTest::test_maxlen", "tests.test_more.SeekableTest::test_maxlen_zero", "tests.test_more.SeekableTest::test_partial_reset", "tests.test_more.SeekableTest::test_passthrough", "tests.test_more.SeekableTest::test_past_end", "tests.test_more.SeekableTest::test_peek_default", "tests.test_more.SeekableTest::test_relative_seek", "tests.test_more.SeekableTest::test_simple_peeking", "tests.test_more.SeekableTest::test_truthiness", "tests.test_more.SequenceViewTests::test_abc_methods", "tests.test_more.SequenceViewTests::test_indexing", "tests.test_more.SequenceViewTests::test_init", "tests.test_more.SequenceViewTests::test_slicing", "tests.test_more.SequenceViewTests::test_update", "tests.test_more.SetPartitionsTests::test_duplicates", "tests.test_more.SetPartitionsTests::test_each_correct", "tests.test_more.SetPartitionsTests::test_found_all", "tests.test_more.SetPartitionsTests::test_max_size", "tests.test_more.SetPartitionsTests::test_min_size", "tests.test_more.SetPartitionsTests::test_no_group", "tests.test_more.SetPartitionsTests::test_repeated", "tests.test_more.SetPartitionsTests::test_stirling_numbers", "tests.test_more.SetPartitionsTests::test_to_many_groups", "tests.test_more.SideEffectTests::test_before_after", "tests.test_more.SideEffectTests::test_before_fails", "tests.test_more.SideEffectTests::test_chunked", "tests.test_more.SideEffectTests::test_individual", "tests.test_more.SlicedTests::test_even", "tests.test_more.SlicedTests::test_not_sliceable", "tests.test_more.SlicedTests::test_numpy_like_array", "tests.test_more.SlicedTests::test_odd", "tests.test_more.SlicedTests::test_odd_and_strict", "tests.test_more.SortTogetherTest::test_invalid_key_list", "tests.test_more.SortTogetherTest::test_key_function", "tests.test_more.SortTogetherTest::test_key_list", "tests.test_more.SortTogetherTest::test_reverse", "tests.test_more.SortTogetherTest::test_strict", "tests.test_more.SortTogetherTest::test_uneven_iterables", "tests.test_more.SplitAfterTest::test_ends_with_sep", "tests.test_more.SplitAfterTest::test_max_split", "tests.test_more.SplitAfterTest::test_no_sep", "tests.test_more.SplitAfterTest::test_starts_with_sep", "tests.test_more.SplitAtTests::test_basic", "tests.test_more.SplitAtTests::test_combination", "tests.test_more.SplitAtTests::test_keep_separator", "tests.test_more.SplitAtTests::test_maxsplit", "tests.test_more.SplitBeforeTest::test_empty_collection", "tests.test_more.SplitBeforeTest::test_ends_with_sep", "tests.test_more.SplitBeforeTest::test_max_split", "tests.test_more.SplitBeforeTest::test_no_sep", "tests.test_more.SplitBeforeTest::test_starts_with_sep", "tests.test_more.SplitIntoTests::test_bool_in_sizes", "tests.test_more.SplitIntoTests::test_both_empty", "tests.test_more.SplitIntoTests::test_generator_iterable_integrity", "tests.test_more.SplitIntoTests::test_generator_sizes_integrity", "tests.test_more.SplitIntoTests::test_invalid_in_sizes", "tests.test_more.SplitIntoTests::test_invalid_in_sizes_after_none", "tests.test_more.SplitIntoTests::test_iterable_empty", "tests.test_more.SplitIntoTests::test_iterable_empty_using_none", "tests.test_more.SplitIntoTests::test_iterable_just_right", "tests.test_more.SplitIntoTests::test_iterable_too_large", "tests.test_more.SplitIntoTests::test_iterable_too_small", "tests.test_more.SplitIntoTests::test_iterable_too_small_extra", "tests.test_more.SplitIntoTests::test_sizes_empty", "tests.test_more.SplitIntoTests::test_using_none_mid_sizes", "tests.test_more.SplitIntoTests::test_using_none_with_leftover", "tests.test_more.SplitIntoTests::test_using_none_without_leftover", "tests.test_more.SplitWhenTests::test_after_emulation_ends_with_sep", "tests.test_more.SplitWhenTests::test_after_emulation_no_sep", "tests.test_more.SplitWhenTests::test_after_emulation_starts_with_sep", "tests.test_more.SplitWhenTests::test_before_emulation_ends_with_sep", "tests.test_more.SplitWhenTests::test_before_emulation_no_sep", "tests.test_more.SplitWhenTests::test_before_emulation_starts_with_sep", "tests.test_more.SplitWhenTests::test_empty_iterable", "tests.test_more.SplitWhenTests::test_max_split", "tests.test_more.SplitWhenTests::test_one_element", "tests.test_more.SplitWhenTests::test_one_element_is_first_item", "tests.test_more.SplitWhenTests::test_one_element_is_second_item", "tests.test_more.SpyTests::test_basic", "tests.test_more.SpyTests::test_immutable", "tests.test_more.SpyTests::test_too_many", "tests.test_more.SpyTests::test_unpacking", "tests.test_more.SpyTests::test_zero", "tests.test_more.StaggerTest::test_default", "tests.test_more.StaggerTest::test_longest", "tests.test_more.StaggerTest::test_offsets", "tests.test_more.StrictlyNTests::test_basic", "tests.test_more.StrictlyNTests::test_too_long_custom", "tests.test_more.StrictlyNTests::test_too_long_default", "tests.test_more.StrictlyNTests::test_too_short_custom", "tests.test_more.StrictlyNTests::test_too_short_default", "tests.test_more.StripFunctionTests::test_hashable", "tests.test_more.StripFunctionTests::test_math", "tests.test_more.StripFunctionTests::test_not_hashable", "tests.test_more.SubstringsIndexesTests::test_basic", "tests.test_more.SubstringsIndexesTests::test_empty", "tests.test_more.SubstringsIndexesTests::test_order", "tests.test_more.SubstringsIndexesTests::test_reverse", "tests.test_more.SubstringsIndexesTests::test_strings", "tests.test_more.SubstringsTests::test_basic", "tests.test_more.SubstringsTests::test_empty", "tests.test_more.SubstringsTests::test_order", "tests.test_more.SubstringsTests::test_strings", "tests.test_more.TakewhileInclusiveTests::test_basic", "tests.test_more.TakewhileInclusiveTests::test_collatz_sequence", "tests.test_more.TakewhileInclusiveTests::test_empty_iterator", "tests.test_more.TestAlwaysIterable::test_base_type", "tests.test_more.TestAlwaysIterable::test_generator", "tests.test_more.TestAlwaysIterable::test_iterables", "tests.test_more.TestAlwaysIterable::test_none", "tests.test_more.TestAlwaysIterable::test_single", "tests.test_more.TestAlwaysIterable::test_strings", "tests.test_more.TestCollapse::test_collapse", "tests.test_more.TestCollapse::test_collapse_flatten", "tests.test_more.TestCollapse::test_collapse_to_bytes", "tests.test_more.TestCollapse::test_collapse_to_level", "tests.test_more.TestCollapse::test_collapse_to_list", "tests.test_more.TestCollapse::test_collapse_to_string", "tests.test_more.TimeLimitedTests::test_basic", "tests.test_more.TimeLimitedTests::test_complete", "tests.test_more.TimeLimitedTests::test_invalid_limit", "tests.test_more.TimeLimitedTests::test_zero_limit", "tests.test_more.UniqueInWindowTests::test_basic", "tests.test_more.UniqueInWindowTests::test_invalid_n", "tests.test_more.UniqueInWindowTests::test_key", "tests.test_more.UniqueToEachTests::test_all_unique", "tests.test_more.UniqueToEachTests::test_duplicates", "tests.test_more.UniqueToEachTests::test_mixed", "tests.test_more.UnzipTests::test_empty_iterable", "tests.test_more.UnzipTests::test_improperly_zipped", "tests.test_more.UnzipTests::test_increasingly_zipped", "tests.test_more.UnzipTests::test_length_one_iterable", "tests.test_more.UnzipTests::test_normal_case", "tests.test_more.ValueChainTests::test_complex", "tests.test_more.ValueChainTests::test_empty", "tests.test_more.ValueChainTests::test_empty_lists", "tests.test_more.ValueChainTests::test_more", "tests.test_more.ValueChainTests::test_simple", "tests.test_more.WindowedCompleteTests::test_basic", "tests.test_more.WindowedCompleteTests::test_every_partition", "tests.test_more.WindowedCompleteTests::test_wrong_length", "tests.test_more.WindowedCompleteTests::test_zero_length", "tests.test_more.WindowedTests::test_basic", "tests.test_more.WindowedTests::test_empty_seq", "tests.test_more.WindowedTests::test_fillvalue", "tests.test_more.WindowedTests::test_fillvalue_step", "tests.test_more.WindowedTests::test_invalid_step", "tests.test_more.WindowedTests::test_negative", "tests.test_more.WindowedTests::test_step", "tests.test_more.WithIterTests::test_with_iter", "tests.test_more.ZipBroadcastTests::test_scalar_types", "tests.test_more.ZipBroadcastTests::test_zip", "tests.test_more.ZipEqualTest::test_deprecation", "tests.test_more.ZipEqualTest::test_equal", "tests.test_more.ZipEqualTest::test_unequal_lists", "tests.test_more.ZipOffsetTest::test_longest", "tests.test_more.ZipOffsetTest::test_mismatch", "tests.test_more.ZipOffsetTest::test_shortest"], "PASS_TO_PASS_flaky": [], "FAIL_TO_PASS_dropped_validator": [], "PASS_TO_PASS_dropped_validator": [], "harness_compatible": true, "env_pinned_to_commit_date": false, "split": "overlap", "statement_source": "issue", "issue_urls": ["https://github.com/more-itertools/more-itertools/issues/1001"], "pr_url": "https://github.com/more-itertools/more-itertools/pull/1028", "fix_commit": "7de169f7ad39eb1f95f8358225476e6f1a59d3d7", "merged_at": "2025-07-14T13:50:03Z", "graph": "graphs/more-itertools_c834d6e4a0c4280b7b7750cb0de8dd8acb3d4c2c.json", "embeddings": "embeddings/more-itertools_c834d6e4a0c4280b7b7750cb0de8dd8acb3d4c2c.npz", "snapshot": "snapshots/more-itertools_1028.tgz", "test_patch_files": ["tests/test_more.py"], "patch_files": ["more_itertools/more.py"], "requirements": ["accessible-pygments==0.0.5", "alabaster==1.0.0", "ast-serialize==0.13.1", "babel==2.18.0", "beautifulsoup4==4.15.0", "certifi==2026.10.23", "cffi==2.1.1", "charset-normalizer==3.5.2", "coverage==7.17.0", "cryptography==50.0.2", "docutils==0.23", "flit-core==4.1.0", "flit==4.1.0", "furo==2025.12.19", "id==1.6.1", "idna==3.20", "imagesize==2.0.1", "iniconfig==2.3.1", "jaraco-classes==3.4.0", "jaraco-context==6.1.2", "jaraco-functools==4.6.0", "jeepney==0.9.0", "jinja2==3.1.6", "keyring==25.7.0", "librt==0.16.0", "markdown-it-py==4.2.0", "markupsafe==3.0.4", "mdurl==0.1.2", "mypy-extensions==1.1.0", "mypy==2.4.0", "nh3==0.3.7", "packaging==26.3", "pathspec==1.1.1", "pip==26.2.2", "pluggy==1.7.0", "pycparser==3.12", "pygments==2.21.0", "pytest==9.1.1", "readme-renderer==46.0", "requests-toolbelt==1.0.0", "requests==2.34.2", "rfc3986==2.0.0", "rich==15.0.0", "roman-numerals==4.1.0", "ruff==0.17.2", "secretstorage==3.5.0", "setuptools==84.2.1", "snowballstemmer==3.1.1", "soupsieve==3.0.4", "sphinx-basic-ng==1.0.0b2", "sphinx==9.2.0", "sphinxcontrib-applehelp==2.0.0", "sphinxcontrib-devhelp==2.0.0", "sphinxcontrib-htmlhelp==2.1.0", "sphinxcontrib-jsmath==2.0.0", "sphinxcontrib-qthelp==2.0.0", "sphinxcontrib-serializinghtml==2.0.0", "tomli-w==1.2.0", "twine==7.0.0", "typing-extensions==4.16.0", "urllib3==2.8.0", "wheel==0.48.0"], "build_requires": ["flit_core >=3.12,<4"], "localization": {"files": ["more_itertools/more.py"], "nodes_edited": ["more_itertools.more.last"], "nodes_added": [], "module_level": [], "aux_files": []}, "quality": {"new_api_in_tests": [], "new_api_unstated": [], "underspecified": false, "f2p_count": 1, "patch_lines": 1, "files_changed": 1, "statement_chars": 1664}, "issue_created_at": "2025-06-17T13:15:01Z", "post_cutoff": true}