﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
37096	test_invalid_choice_db_option fails on Python 3.14.5+	Kasey	Kasey	"On Python 3.14.5+, `admin_scripts.tests.CommandDBOptionChoiceTests.test_invalid_choice_db_option` fails with:

{{{
AssertionError: ""Error: argument --database: invalid choice: 'deflaut',
maybe you meant 'default'\? \(choose from default, other\)"" does not match
""Error: argument --database: invalid choice: 'deflaut', maybe you meant
'default'? (choose from 'default', 'other')""
}}}

== Cause ==

CPython 3.14.5 restored quoting of choice values in argparse's ""invalid choice"" error messages via [https://github.com/python/cpython/pull/149385 cpython#149385] (3.14 backport of [https://github.com/python/cpython/pull/130751 cpython#130751], tracked in [https://github.com/python/cpython/issues/130750 cpython#130750]). The `choices` formatter changed from:

{{{#!python
'choices': ', '.join(map(str, action.choices))           # 3.14.0–3.14.4
}}}

to:

{{{#!python
'choices': ', '.join(repr(str(choice)) for choice in action.choices)  # 3.14.5+
}}}

so the message goes from `(choose from default, other)` to `(choose from 'default', 'other')`.

The `PY314` branch of the test (added in commit [https://github.com/django/django/commit/b1a65eac7c b1a65eac7c], fixing #36321) expected the unquoted form. The pre-3.14 branch already handles both forms via `'?default'?, '?other'?`; aligning the `PY314` branch with the same pattern fixes the test on all Python 3.14.x releases.

== Scope ==

`main` only. `stable/6.0.x` and `stable/5.2.x` are unaffected — neither branch enables `suggest_on_error` (added in #36321 on `main`), and both already use the flexible `'?default'?, '?other'?` pattern.

== Patch ==

Patch ready (one-line test regex fix). PR link will follow in a comment once the ticket is accepted.
"	Bug	closed	Core (Management commands)	dev	Release blocker	fixed			Ready for checkin	1	0	0	0	0	0
