Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
sqlite3.test.factory.TextFactoryTests Class Reference

List of all members.

Public Member Functions

def setUp
def CheckUnicode
def CheckString
def CheckCustom
def CheckOptimizedUnicode
def tearDown

Public Attributes

 con

Detailed Description

Definition at line 157 of file factory.py.


Member Function Documentation

Definition at line 173 of file factory.py.

00173 
00174     def CheckCustom(self):
00175         self.con.text_factory = lambda x: str(x, "utf-8", "ignore")
00176         austria = "Österreich"
00177         row = self.con.execute("select ?", (austria,)).fetchone()
00178         self.assertTrue(type(row[0]) == str, "type of row[0] must be unicode")
00179         self.assertTrue(row[0].endswith("reich"), "column must contain original data")

Here is the call graph for this function:

Definition at line 180 of file factory.py.

00180 
00181     def CheckOptimizedUnicode(self):
00182         self.con.text_factory = sqlite.OptimizedUnicode
00183         austria = "Österreich"
00184         germany = "Deutchland"
00185         a_row = self.con.execute("select ?", (austria,)).fetchone()
00186         d_row = self.con.execute("select ?", (germany,)).fetchone()
00187         self.assertTrue(type(a_row[0]) == str, "type of non-ASCII row must be str")
00188         self.assertTrue(type(d_row[0]) == str, "type of ASCII-only row must be str")

Here is the call graph for this function:

Definition at line 166 of file factory.py.

00166 
00167     def CheckString(self):
00168         self.con.text_factory = bytes
00169         austria = "Österreich"
00170         row = self.con.execute("select ?", (austria,)).fetchone()
00171         self.assertTrue(type(row[0]) == bytes, "type of row[0] must be bytes")
00172         self.assertTrue(row[0] == austria.encode("utf-8"), "column must equal original data in UTF-8")

Here is the call graph for this function:

Definition at line 161 of file factory.py.

00161 
00162     def CheckUnicode(self):
00163         austria = "Österreich"
00164         row = self.con.execute("select ?", (austria,)).fetchone()
00165         self.assertTrue(type(row[0]) == str, "type of row[0] must be unicode")

Here is the call graph for this function:

Definition at line 158 of file factory.py.

00158 
00159     def setUp(self):
00160         self.con = sqlite.connect(":memory:")

Here is the caller graph for this function:

Definition at line 189 of file factory.py.

00189 
00190     def tearDown(self):
00191         self.con.close()

Here is the caller graph for this function:


Member Data Documentation

Definition at line 159 of file factory.py.


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