Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
sqlite3.test.dbapi.ConnectionTests Class Reference

List of all members.

Public Member Functions

def setUp
def tearDown
def CheckCommit
def CheckCommitAfterNoChanges
def CheckRollback
def CheckRollbackAfterNoChanges
def CheckCursor
def CheckFailedOpen
def CheckClose
def CheckExceptions
def CheckInTransaction
def CheckInTransactionRO

Public Attributes

 cx

Detailed Description

Definition at line 86 of file dbapi.py.


Member Function Documentation

Definition at line 128 of file dbapi.py.

00128 
00129     def CheckClose(self):
00130         self.cx.close()

Definition at line 97 of file dbapi.py.

00097 
00098     def CheckCommit(self):
00099         self.cx.commit()

A commit should also work when no changes were made to the database.

Definition at line 100 of file dbapi.py.

00100 
00101     def CheckCommitAfterNoChanges(self):
00102         """
00103         A commit should also work when no changes were made to the database.
00104         """
00105         self.cx.commit()
00106         self.cx.commit()

Definition at line 117 of file dbapi.py.

00117 
00118     def CheckCursor(self):
00119         cu = self.cx.cursor()

Definition at line 131 of file dbapi.py.

00131 
00132     def CheckExceptions(self):
00133         # Optional DB-API extension.
00134         self.assertEqual(self.cx.Warning, sqlite.Warning)
00135         self.assertEqual(self.cx.Error, sqlite.Error)
00136         self.assertEqual(self.cx.InterfaceError, sqlite.InterfaceError)
00137         self.assertEqual(self.cx.DatabaseError, sqlite.DatabaseError)
00138         self.assertEqual(self.cx.DataError, sqlite.DataError)
00139         self.assertEqual(self.cx.OperationalError, sqlite.OperationalError)
00140         self.assertEqual(self.cx.IntegrityError, sqlite.IntegrityError)
00141         self.assertEqual(self.cx.InternalError, sqlite.InternalError)
00142         self.assertEqual(self.cx.ProgrammingError, sqlite.ProgrammingError)
00143         self.assertEqual(self.cx.NotSupportedError, sqlite.NotSupportedError)

Here is the call graph for this function:

Definition at line 120 of file dbapi.py.

00120 
00121     def CheckFailedOpen(self):
00122         YOU_CANNOT_OPEN_THIS = "/foo/bar/bla/23534/mydb.db"
00123         try:
00124             con = sqlite.connect(YOU_CANNOT_OPEN_THIS)
00125         except sqlite.OperationalError:
00126             return
00127         self.fail("should have raised an OperationalError")

Here is the call graph for this function:

Definition at line 144 of file dbapi.py.

00144 
00145     def CheckInTransaction(self):
00146         # Can't use db from setUp because we want to test initial state.
00147         cx = sqlite.connect(":memory:")
00148         cu = cx.cursor()
00149         self.assertEqual(cx.in_transaction, False)
00150         cu.execute("create table transactiontest(id integer primary key, name text)")
00151         self.assertEqual(cx.in_transaction, False)
00152         cu.execute("insert into transactiontest(name) values (?)", ("foo",))
00153         self.assertEqual(cx.in_transaction, True)
00154         cu.execute("select name from transactiontest where name=?", ["foo"])
00155         row = cu.fetchone()
00156         self.assertEqual(cx.in_transaction, True)
00157         cx.commit()
00158         self.assertEqual(cx.in_transaction, False)
00159         cu.execute("select name from transactiontest where name=?", ["foo"])
00160         row = cu.fetchone()
00161         self.assertEqual(cx.in_transaction, False)

Here is the call graph for this function:

Definition at line 162 of file dbapi.py.

00162 
00163     def CheckInTransactionRO(self):
00164         with self.assertRaises(AttributeError):
00165             self.cx.in_transaction = True

Here is the call graph for this function:

Definition at line 107 of file dbapi.py.

00107 
00108     def CheckRollback(self):
00109         self.cx.rollback()

A rollback should also work when no changes were made to the database.

Definition at line 110 of file dbapi.py.

00110 
00111     def CheckRollbackAfterNoChanges(self):
00112         """
00113         A rollback should also work when no changes were made to the database.
00114         """
00115         self.cx.rollback()
00116         self.cx.rollback()

Definition at line 88 of file dbapi.py.

00088 
00089     def setUp(self):
00090         self.cx = sqlite.connect(":memory:")
00091         cu = self.cx.cursor()
00092         cu.execute("create table test(id integer primary key, name text)")
00093         cu.execute("insert into test(name) values (?)", ("foo",))

Here is the caller graph for this function:

Definition at line 94 of file dbapi.py.

00094 
00095     def tearDown(self):
00096         self.cx.close()

Here is the caller graph for this function:


Member Data Documentation

Definition at line 89 of file dbapi.py.


The documentation for this class was generated from the following file: