summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGerhard Häring <gh@ghaering.de>2007-08-10 18:15:11 (GMT)
committerGerhard Häring <gh@ghaering.de>2007-08-10 18:15:11 (GMT)
commit6d21456137836b8acd551cf6a51999ad4ff10a91 (patch)
treea9cdbf533531b1326623f704e6155350dddb0b17 /Lib
parentbd4a63e091ddb38a2d55d9c21eee8656863240ca (diff)
downloadcpython-6d21456137836b8acd551cf6a51999ad4ff10a91.zip
cpython-6d21456137836b8acd551cf6a51999ad4ff10a91.tar.gz
cpython-6d21456137836b8acd551cf6a51999ad4ff10a91.tar.bz2
Make the sqlite tests pass.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/sqlite3/test/factory.py18
-rw-r--r--Lib/sqlite3/test/types.py6
-rw-r--r--Lib/sqlite3/test/userfunctions.py4
3 files changed, 14 insertions, 14 deletions
diff --git a/Lib/sqlite3/test/factory.py b/Lib/sqlite3/test/factory.py
index 61edc6c..f20848f 100644
--- a/Lib/sqlite3/test/factory.py
+++ b/Lib/sqlite3/test/factory.py
@@ -139,32 +139,32 @@ class TextFactoryTests(unittest.TestCase):
self.con = sqlite.connect(":memory:")
def CheckUnicode(self):
- austria = str("Österreich", "latin1")
+ austria = "Österreich"
row = self.con.execute("select ?", (austria,)).fetchone()
self.failUnless(type(row[0]) == str, "type of row[0] must be unicode")
def CheckString(self):
- self.con.text_factory = str
- austria = str("Österreich", "latin1")
+ self.con.text_factory = bytes
+ austria = "Österreich"
row = self.con.execute("select ?", (austria,)).fetchone()
- self.failUnless(type(row[0]) == str, "type of row[0] must be str")
+ self.failUnless(type(row[0]) == bytes, "type of row[0] must be bytes")
self.failUnless(row[0] == austria.encode("utf-8"), "column must equal original data in UTF-8")
def CheckCustom(self):
self.con.text_factory = lambda x: str(x, "utf-8", "ignore")
- austria = str("Österreich", "latin1")
- row = self.con.execute("select ?", (austria.encode("latin1"),)).fetchone()
+ austria = "Österreich"
+ row = self.con.execute("select ?", (austria,)).fetchone()
self.failUnless(type(row[0]) == str, "type of row[0] must be unicode")
self.failUnless(row[0].endswith("reich"), "column must contain original data")
def CheckOptimizedUnicode(self):
self.con.text_factory = sqlite.OptimizedUnicode
- austria = str("Österreich", "latin1")
- germany = str("Deutchland")
+ austria = "Österreich"
+ germany = "Deutchland"
a_row = self.con.execute("select ?", (austria,)).fetchone()
d_row = self.con.execute("select ?", (germany,)).fetchone()
self.failUnless(type(a_row[0]) == str, "type of non-ASCII row must be unicode")
- self.failUnless(type(d_row[0]) == str, "type of ASCII-only row must be str")
+ self.failUnless(type(d_row[0]) == str8, "type of ASCII-only row must be str8")
def tearDown(self):
self.con.close()
diff --git a/Lib/sqlite3/test/types.py b/Lib/sqlite3/test/types.py
index 232a32c..20f0093 100644
--- a/Lib/sqlite3/test/types.py
+++ b/Lib/sqlite3/test/types.py
@@ -62,7 +62,7 @@ class SqliteTypeTests(unittest.TestCase):
self.failUnlessEqual(row[0], val)
def CheckBlob(self):
- val = buffer("Guglhupf")
+ val = buffer(b"Guglhupf")
self.cur.execute("insert into test(b) values (?)", (val,))
self.cur.execute("select b from test")
row = self.cur.fetchone()
@@ -203,7 +203,7 @@ class DeclTypesTests(unittest.TestCase):
def CheckBlob(self):
# default
- val = buffer("Guglhupf")
+ val = buffer(b"Guglhupf")
self.cur.execute("insert into test(bin) values (?)", (val,))
self.cur.execute("select bin from test")
row = self.cur.fetchone()
@@ -304,7 +304,7 @@ class BinaryConverterTests(unittest.TestCase):
self.con.close()
def CheckBinaryInputForConverter(self):
- testdata = "abcdefg" * 10
+ testdata = b"abcdefg" * 10
result = self.con.execute('select ? as "x [bin]"', (buffer(bz2.compress(testdata)),)).fetchone()[0]
self.failUnlessEqual(testdata, result)
diff --git a/Lib/sqlite3/test/userfunctions.py b/Lib/sqlite3/test/userfunctions.py
index a2f2574..bc8e6d2 100644
--- a/Lib/sqlite3/test/userfunctions.py
+++ b/Lib/sqlite3/test/userfunctions.py
@@ -36,7 +36,7 @@ def func_returnfloat():
def func_returnnull():
return None
def func_returnblob():
- return buffer("blob")
+ return buffer(b"blob")
def func_raiseexception():
5/0
@@ -197,7 +197,7 @@ class FunctionTests(unittest.TestCase):
cur.execute("select returnblob()")
val = cur.fetchone()[0]
self.failUnlessEqual(type(val), buffer)
- self.failUnlessEqual(val, buffer("blob"))
+ self.failUnlessEqual(val, buffer(b"blob"))
def CheckFuncException(self):
cur = self.con.cursor()