[SQL-CVS] r4665 - SQLObject/branches/1.5/sqlobject/tests
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: <sub...@co...> - 2013-10-05 12:23:29
|
Author: phd
Date: Sat Oct 5 06:23:22 2013
New Revision: 4665
Log:
Add a test for pgcode
Modified:
SQLObject/branches/1.5/sqlobject/tests/test_exceptions.py
Modified: SQLObject/branches/1.5/sqlobject/tests/test_exceptions.py
==============================================================================
--- SQLObject/branches/1.5/sqlobject/tests/test_exceptions.py Sat Oct 5 06:04:46 2013 (r4664)
+++ SQLObject/branches/1.5/sqlobject/tests/test_exceptions.py Sat Oct 5 06:23:22 2013 (r4665)
@@ -1,5 +1,5 @@
from sqlobject import *
-from sqlobject.dberrors import DuplicateEntryError
+from sqlobject.dberrors import *
from sqlobject.tests.dbtest import *
########################################
@@ -9,9 +9,23 @@
class TestException(SQLObject):
name = StringCol(unique=True, length=100)
+class TestExceptionWithNonexistingTable(SQLObject):
+ pass
+
def test_exceptions():
if not supports("exceptions"):
return
setupClass(TestException)
TestException(name="test")
raises(DuplicateEntryError, TestException, name="test")
+
+ connection = getConnection()
+ if connection.module.__name__ != 'psycopg2':
+ return
+ TestExceptionWithNonexistingTable.setConnection(connection)
+ try:
+ list(TestExceptionWithNonexistingTable.select())
+ except ProgrammingError, e:
+ assert e.args[0].code == '42P01'
+ else:
+ assert False, "DID NOT RAISE"
|