~cboylan/+junk/test_drizzle_dbapi

« back to all changes in this revision

Viewing changes to dbapi20.py

  • Committer: zenzen
  • Date: 2003-10-08 20:14:14 UTC
  • Revision ID: cvs-1:zenzen-20031008201414-x89di2y0reo3niwi
Add test for DB API 2.0 optional extension, where database exceptions
are exposed as attributes on the Connection object.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
    -- Ian Bicking
12
12
'''
13
13
 
14
 
__rcs_id__  = '$Id: dbapi20.py,v 1.9 2003/08/13 01:16:36 zenzen Exp $'
15
 
__version__ = '$Revision: 1.9 $'[11:-2]
 
14
__rcs_id__  = '$Id: dbapi20.py,v 1.10 2003/10/09 03:14:14 zenzen Exp $'
 
15
__version__ = '$Revision: 1.10 $'[11:-2]
16
16
__author__ = 'Stuart Bishop <zen@shangri-la.dropbear.id.au>'
17
17
 
18
18
import unittest
19
19
import time
20
20
 
21
21
# $Log: dbapi20.py,v $
 
22
# Revision 1.10  2003/10/09 03:14:14  zenzen
 
23
# Add test for DB API 2.0 optional extension, where database exceptions
 
24
# are exposed as attributes on the Connection object.
 
25
#
22
26
# Revision 1.9  2003/08/13 01:16:36  zenzen
23
27
# Minor tweak from Stefan Fleiter
24
28
#
194
198
            issubclass(self.driver.NotSupportedError,self.driver.Error)
195
199
            )
196
200
 
 
201
    def test_ExceptionsAsConnectionAttributes(self):
 
202
        # OPTIONAL EXTENSION
 
203
        # Test for the optional DB API 2.0 extension, where the exceptions
 
204
        # are exposed as attributes on the Connection object
 
205
        # I figure this optional extension will be implemented by any
 
206
        # driver author who is using this test suite, so it is enabled
 
207
        # by default.
 
208
        con = self._connect()
 
209
        drv = self.driver
 
210
        self.failUnless(con.Warning is drv.Warning)
 
211
        self.failUnless(con.Error is drv.Error)
 
212
        self.failUnless(con.InterfaceError is drv.InterfaceError)
 
213
        self.failUnless(con.DatabaseError is drv.DatabaseError)
 
214
        self.failUnless(con.OperationalError is drv.OperationalError)
 
215
        self.failUnless(con.IntegrityError is drv.IntegrityError)
 
216
        self.failUnless(con.InternalError is drv.InternalError)
 
217
        self.failUnless(con.ProgrammingError is drv.ProgrammingError)
 
218
        self.failUnless(con.NotSupportedError is drv.NotSupportedError)
 
219
 
 
220
 
197
221
    def test_commit(self):
198
222
        con = self._connect()
199
223
        try: