Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f188e0f

Browse filesBrowse files
committed
Fix some tests.
1 parent e8c1ebb commit f188e0f
Copy full SHA for f188e0f

File tree

Expand file treeCollapse file tree

2 files changed

+7
-5
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+7
-5
lines changed

‎MySQLdb/connections.py

Copy file name to clipboardExpand all lines: MySQLdb/connections.py
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,12 @@ def string_literal(obj, dummy=None):
212212
return string_literal
213213

214214
def _get_unicode_literal():
215-
def unicode_literal(u, dummy=None):
216-
return db.literal(u.encode(unicode_literal.charset))
215+
if PY2:
216+
def unicode_literal(u, dummy=None):
217+
return db.literal(u.encode(unicode_literal.charset))
218+
else:
219+
def unicode_literal(u, dummy=None):
220+
return db.literal(str(u).encode(unicode_literal.charset))
217221
return unicode_literal
218222

219223
def _get_string_decoder():

‎tests/capabilities.py

Copy file name to clipboardExpand all lines: tests/capabilities.py
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,8 @@ def setUp(self):
2727
db = connection_factory(**self.connect_kwargs)
2828
self.connection = db
2929
self.cursor = db.cursor()
30-
# TODO: this needs to be re-evaluated for Python 3
31-
self.BLOBText = ''.join([chr(i) for i in range(256)] * 100);
3230
self.BLOBUText = u''.join([unichr(i) for i in range(16384)])
33-
self.BLOBBinary = self.db_module.Binary(''.join([chr(i) for i in range(256)] * 16))
31+
self.BLOBBinary = self.db_module.Binary((u''.join([unichr(i) for i in range(256)] * 16)).encode('latin1'))
3432

3533
leak_test = True
3634

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.