File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 88 ForeignKey ,
99 Table ,
1010 View ,
11+ NoTable ,
12+ NoView ,
1113)
1214from sqlite_utils .utils import hash_record , sqlite3
1315import collections
@@ -1367,3 +1369,14 @@ def test_create_strict(fresh_db, strict):
13671369 table = fresh_db ["t" ]
13681370 table .create ({"id" : int }, strict = strict )
13691371 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"
You can’t perform that action at this time.
0 commit comments