mirror of
https://github.com/PyMySQL/mysqlclient.git
synced 2025-08-15 11:10:58 +08:00
Fix some tests.
This commit is contained in:
@ -212,8 +212,12 @@ class Connection(_mysql.connection):
|
|||||||
return string_literal
|
return string_literal
|
||||||
|
|
||||||
def _get_unicode_literal():
|
def _get_unicode_literal():
|
||||||
|
if PY2:
|
||||||
def unicode_literal(u, dummy=None):
|
def unicode_literal(u, dummy=None):
|
||||||
return db.literal(u.encode(unicode_literal.charset))
|
return db.literal(u.encode(unicode_literal.charset))
|
||||||
|
else:
|
||||||
|
def unicode_literal(u, dummy=None):
|
||||||
|
return db.literal(str(u).encode(unicode_literal.charset))
|
||||||
return unicode_literal
|
return unicode_literal
|
||||||
|
|
||||||
def _get_string_decoder():
|
def _get_string_decoder():
|
||||||
|
@ -27,10 +27,8 @@ class DatabaseTest(unittest.TestCase):
|
|||||||
db = connection_factory(**self.connect_kwargs)
|
db = connection_factory(**self.connect_kwargs)
|
||||||
self.connection = db
|
self.connection = db
|
||||||
self.cursor = db.cursor()
|
self.cursor = db.cursor()
|
||||||
# TODO: this needs to be re-evaluated for Python 3
|
|
||||||
self.BLOBText = ''.join([chr(i) for i in range(256)] * 100);
|
|
||||||
self.BLOBUText = u''.join([unichr(i) for i in range(16384)])
|
self.BLOBUText = u''.join([unichr(i) for i in range(16384)])
|
||||||
self.BLOBBinary = self.db_module.Binary(''.join([chr(i) for i in range(256)] * 16))
|
self.BLOBBinary = self.db_module.Binary((u''.join([unichr(i) for i in range(256)] * 16)).encode('latin1'))
|
||||||
|
|
||||||
leak_test = True
|
leak_test = True
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user