Skip to content

Commit

Permalink
fixed breaking tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fenrir-san committed Dec 18, 2023
1 parent 05759fd commit be45403
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions src/tests/test_magic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2466,6 +2466,9 @@ def test_query_comment_after_semicolon(ip, query, expected):
assert list(result.dict().values())[-1][0] == expected


error_message_link = "https://jupysql.ploomber.io/en/latest/compose.html#with-argument"


@pytest.mark.parametrize(
"query, error_type, error_message",
[
Expand All @@ -2474,33 +2477,32 @@ def test_query_comment_after_semicolon(ip, query, expected):
SELECT * FROM snip;
SELECT * from temp;""",
"TableNotFoundError",
"""If using snippets, you may pass the --with argument explicitly.
For more details please refer: \
https://jupysql.ploomber.io/en/latest/compose.html#with-argument
f"""If using snippets, you may pass the --with argument explicitly.
For more details please refer: {error_message_link}
There is no table with name 'snip'.
Did you mean: 'snippet'
Original error message from DB driver:
(duckdb.duckdb.CatalogException) Catalog Error: Table with name snip does not exist!
(duckdb.CatalogException) Catalog Error: Table with name snip does not exist!
Did you mean "temp"?
LINE 1: SELECT * FROM snip;
^
[SQL: SELECT * FROM snip;]""",
[SQL: SELECT * FROM snip;]
""",
),
(
"""%%sql
SELECT * FROM snippet;
SELECT * from tem;""",
"RuntimeError",
"""If using snippets, you may pass the --with argument explicitly.
For more details please refer: \
https://jupysql.ploomber.io/en/latest/compose.html#with-argument
f"""If using snippets, you may pass the --with argument explicitly.
For more details please refer: {error_message_link}
Original error message from DB driver:
(duckdb.duckdb.CatalogException) Catalog Error: Table with name tem does not exist!
(duckdb.CatalogException) Catalog Error: Table with name tem does not exist!
Did you mean "temp"?
LINE 1: SELECT * from tem;
^
Expand All @@ -2511,16 +2513,15 @@ def test_query_comment_after_semicolon(ip, query, expected):
SELECT * FROM snip;
SELECT * from tem;""",
"TableNotFoundError",
"""If using snippets, you may pass the --with argument explicitly.
For more details please refer: \
https://jupysql.ploomber.io/en/latest/compose.html#with-argument
f"""If using snippets, you may pass the --with argument explicitly.
For more details please refer: {error_message_link}
There is no table with name 'snip'.
Did you mean: 'snippet'
Original error message from DB driver:
(duckdb.duckdb.CatalogException) Catalog Error: Table with name snip does not exist!
(duckdb.CatalogException) Catalog Error: Table with name snip does not exist!
Did you mean "temp"?
LINE 1: SELECT * FROM snip;
^
Expand All @@ -2531,31 +2532,30 @@ def test_query_comment_after_semicolon(ip, query, expected):
SELECT * FROM s;
SELECT * from temp;""",
"RuntimeError",
"""If using snippets, you may pass the --with argument explicitly.
For more details please refer: \
https://jupysql.ploomber.io/en/latest/compose.html#with-argument
f"""If using snippets, you may pass the --with argument explicitly.
For more details please refer: {error_message_link}
Original error message from DB driver:
(duckdb.duckdb.CatalogException) Catalog Error: Table with name s does not exist!
(duckdb.CatalogException) Catalog Error: Table with name s does not exist!
Did you mean "temp"?
LINE 1: SELECT * FROM s;
^
[SQL: SELECT * FROM s;]""",
[SQL: SELECT * FROM s;]
""",
),
(
"""%%sql
DROP TABLE temp;
SELECT * FROM snippet;
SELECT * from temp;""",
"RuntimeError",
"""If using snippets, you may pass the --with argument explicitly.
For more details please refer: \
https://jupysql.ploomber.io/en/latest/compose.html#with-argument
f"""If using snippets, you may pass the --with argument explicitly.
For more details please refer: {error_message_link}
Original error message from DB driver:
(duckdb.duckdb.CatalogException) Catalog Error: Table with name snippet does not exist!
(duckdb.CatalogException) Catalog Error: Table with name snippet does not exist!
Did you mean "pg_type"?
LINE 1: SELECT * FROM snippet;
^
Expand Down Expand Up @@ -2595,6 +2595,7 @@ def test_table_does_not_exist_with_snippet_error(
ip_empty.run_cell(query)

# Test error and message
print(excinfo.value)
assert error_type == excinfo.value.error_type
assert error_message in str(excinfo.value)

Expand Down

0 comments on commit be45403

Please sign in to comment.