File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
Filter options
Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
Original file line number Diff line number Diff line change @@ -212,8 +212,12 @@ def string_literal(obj, dummy=None):
212
212
return string_literal
213
213
214
214
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 ))
217
221
return unicode_literal
218
222
219
223
def _get_string_decoder ():
Original file line number Diff line number Diff line change @@ -27,10 +27,8 @@ def setUp(self):
27
27
db = connection_factory (** self .connect_kwargs )
28
28
self .connection = db
29
29
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 );
32
30
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' ))
34
32
35
33
leak_test = True
36
34
You can’t perform that action at this time.
0 commit comments