We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 08be98f commit 9b2136bCopy full SHA for 9b2136b
1 file changed
tests/test_create.py
@@ -8,6 +8,8 @@
8
ForeignKey,
9
Table,
10
View,
11
+ NoTable,
12
+ NoView,
13
)
14
from sqlite_utils.utils import hash_record, sqlite3
15
import collections
@@ -1367,3 +1369,14 @@ def test_create_strict(fresh_db, strict):
1367
1369
table = fresh_db["t"]
1368
1370
table.create({"id": int}, strict=strict)
1371
assert table.strict == strict or not fresh_db.supports_strict
1372
+
1373
1374
+def test_bad_table_and_view_exceptions(fresh_db):
1375
+ fresh_db.table("t").insert({"id": 1}, pk="id")
1376
+ fresh_db.create_view("v", "select * from t")
1377
+ with pytest.raises(NoTable) as ex:
1378
+ fresh_db.table("v")
1379
+ assert ex.value.args[0] == "Table v is actually a view"
1380
+ with pytest.raises(NoView) as ex2:
1381
+ fresh_db.view("t")
1382
+ assert ex2.value.args[0] == "View t does not exist"
0 commit comments