aboutsummaryrefslogtreecommitdiffstats
path: root/tests/util
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2011-10-07 15:03:53 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:56:13 -0300
commit1cefc091180ec4cf44e68e2a776ae1b4bc6d189b (patch)
tree4d9dc31df2e311577baae67383917835f46c8d44 /tests/util
parentb841afdb5c09ab431110b34ee463b95d64557731 (diff)
Fixed unittest to work with python3.
Diffstat (limited to 'tests/util')
-rw-r--r--tests/util/py3xfunctions.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/util/py3xfunctions.py b/tests/util/py3xfunctions.py
index 1dd5148df..3b89867a6 100644
--- a/tests/util/py3xfunctions.py
+++ b/tests/util/py3xfunctions.py
@@ -1,6 +1,14 @@
def b(s):
return bytes(s, "UTF8")
+def buffer_(s):
+ if s == None:
+ return None
+ elif type(s) == str:
+ return bytes(s, "UTF8")
+ else:
+ memoryview(s)
+
def l(n):
return n
@@ -11,4 +19,4 @@ unicode = str
unichr = chr
long = int
unichr = chr
-buffer = b
+buffer = buffer_