mirror of
https://github.com/python/cpython.git
synced 2025-10-27 03:34:32 +00:00
gh-133439: Fix the error message in the sqlite3 CLI (GH-133807)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
9731dd2c8d
commit
ecd83e02b1
2 changed files with 4 additions and 4 deletions
|
|
@ -63,7 +63,7 @@ def runsource(self, source, filename="<input>", symbol="single"):
|
||||||
if source[0] == ".":
|
if source[0] == ".":
|
||||||
match source[1:].strip():
|
match source[1:].strip():
|
||||||
case "version":
|
case "version":
|
||||||
print(f"{sqlite3.sqlite_version}")
|
print(sqlite3.sqlite_version)
|
||||||
case "help":
|
case "help":
|
||||||
print("Enter SQL code and press enter.")
|
print("Enter SQL code and press enter.")
|
||||||
case "quit":
|
case "quit":
|
||||||
|
|
@ -73,7 +73,7 @@ def runsource(self, source, filename="<input>", symbol="single"):
|
||||||
case _ as unknown:
|
case _ as unknown:
|
||||||
t = theme.traceback
|
t = theme.traceback
|
||||||
self.write(f'{t.type}Error{t.reset}: {t.message}unknown '
|
self.write(f'{t.type}Error{t.reset}: {t.message}unknown '
|
||||||
f'command or invalid arguments: "{unknown}".\n{t.reset}')
|
f'command: "{unknown}"{t.reset}\n')
|
||||||
else:
|
else:
|
||||||
if not sqlite3.complete_statement(source):
|
if not sqlite3.complete_statement(source):
|
||||||
return True
|
return True
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ def test_interact_dot_commands_unknown(self):
|
||||||
self.assertEndsWith(out, self.PS1)
|
self.assertEndsWith(out, self.PS1)
|
||||||
self.assertEqual(out.count(self.PS1), 2)
|
self.assertEqual(out.count(self.PS1), 2)
|
||||||
self.assertEqual(out.count(self.PS2), 0)
|
self.assertEqual(out.count(self.PS2), 0)
|
||||||
self.assertIn("Error", err)
|
self.assertIn('Error: unknown command: "', err)
|
||||||
# test "unknown_command" is pointed out in the error message
|
# test "unknown_command" is pointed out in the error message
|
||||||
self.assertIn("unknown_command", err)
|
self.assertIn("unknown_command", err)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue