From a6567ec507e235fd4d313c6b1570d5a4f45e4b86 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Mon, 9 Aug 2021 15:33:33 -0700 Subject: [PATCH] Capture parameters= not params=, refs #309 --- sqlite_utils/cli.py | 10 +++++----- tests/test_cli.py | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sqlite_utils/cli.py b/sqlite_utils/cli.py index 0acb252..d94229d 100644 --- a/sqlite_utils/cli.py +++ b/sqlite_utils/cli.py @@ -795,12 +795,12 @@ def insert_upsert_implementation( raise click.ClickException( "{}\n\nTry using --alter to add additional columns".format(e.args[0]) ) - # If we can find sql= and params= arguments, show those - variables = _find_variables(e.__traceback__, ["sql", "params"]) - if "sql" in variables and "params" in variables: + # If we can find sql= and parameters= arguments, show those + variables = _find_variables(e.__traceback__, ["sql", "parameters"]) + if "sql" in variables and "parameters" in variables: raise click.ClickException( - "{}\n\nsql = {}\nparams={}".format( - str(e), variables["sql"], variables["params"] + "{}\n\nsql = {}\nparameters = {}".format( + str(e), variables["sql"], variables["parameters"] ) ) else: diff --git a/tests/test_cli.py b/tests/test_cli.py index 319bd40..d4801ac 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1259,7 +1259,7 @@ def test_upsert_alter(db_path, tmpdir): assert ( "Error: no such column: age\n\n" "sql = UPDATE [dogs] SET [age] = ? WHERE [id] = ?\n" - "params=[5, 1]" + "parameters = [5, 1]" ) == result.output.strip() # Should succeed with --alter result = CliRunner().invoke( @@ -2321,5 +2321,5 @@ def test_integer_overflow_error(tmpdir): assert result.output == ( "Error: Python int too large to convert to SQLite INTEGER\n\n" "sql = INSERT INTO [items] ([bignumber]) VALUES (?);\n" - "params=[34223049823094832094802398430298048240]\n" + "parameters = [34223049823094832094802398430298048240]\n" )