]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Added test for DBAPIError exception wrapping.
authorJason Kirtland <jek@discorporate.us>
Sun, 14 Oct 2007 16:31:21 +0000 (16:31 +0000)
committerJason Kirtland <jek@discorporate.us>
Sun, 14 Oct 2007 16:31:21 +0000 (16:31 +0000)
test/engine/execute.py

index 3d3b43f9b61d7802e761a30868408d2b9eef9159..28faf1102ef107aa3cc3dc5a7c67074fe8df33f8 100644 (file)
@@ -1,5 +1,6 @@
 import testbase
 from sqlalchemy import *
+from sqlalchemy import exceptions
 from testlib import *
 
 class ExecuteTest(PersistTest):
@@ -61,6 +62,14 @@ class ExecuteTest(PersistTest):
             res = conn.execute("select * from users")
             assert res.fetchall() == [(1, "jack"), (2, "ed"), (3, "horse"), (4, 'sally')]
             conn.execute("delete from users")
-        
+
+    def test_exception_wrapping(self):
+        for conn in (testbase.db, testbase.db.connect()):
+            try:
+                conn.execute("osdjafioajwoejoasfjdoifjowejfoawejqoijwef")
+                assert False
+            except exceptions.DBAPIError:
+                assert True
+
 if __name__ == "__main__":
     testbase.main()