gh-130999: Avoid exiting the new REPL when there are non-string candidates for suggestions (gh-131001)

This commit is contained in:
devdanzin 2025-06-02 08:04:59 -03:00 committed by GitHub
parent 5f61cde80a
commit baccfdb3d4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 48 additions and 2 deletions

View file

@ -1672,6 +1672,17 @@ def test_null_byte(self):
self.assertEqual(exit_code, 0)
self.assertNotIn("TypeError", output)
@force_not_colorized
def test_non_string_suggestion_candidates(self):
commands = ("import runpy\n"
"runpy._run_module_code('blech', {0: '', 'bluch': ''}, '')\n"
"exit()\n")
output, exit_code = self.run_repl(commands)
self.assertEqual(exit_code, 0)
self.assertNotIn("all elements in 'candidates' must be strings", output)
self.assertIn("bluch", output)
def test_readline_history_file(self):
# skip, if readline module is not available
readline = import_module('readline')