From 87ffb437d852fbb720a41563febb779c90b7da25 Mon Sep 17 00:00:00 2001 From: Thomas Kluyver Date: Sun, 30 Sep 2012 15:08:20 +0100 Subject: [PATCH] Fix a couple of tests for Python 3 --- test/metadata.py | 8 +++++--- test/testall.py | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/test/metadata.py b/test/metadata.py index 4d877ed..90b6ae8 100644 --- a/test/metadata.py +++ b/test/metadata.py @@ -1,3 +1,5 @@ +from __future__ import print_function + import unittest from llvm.core import * @@ -47,7 +49,7 @@ class TestMetaData(unittest.TestCase): ops = [MetaDataString.get(mod, "int"), root] md1 = MetaData.get(mod, ops) MetaData.add_named_operand(mod, 'tbaa', md1) - print md1 + print(md1) ops = [MetaDataString.get(mod, "const float"), root, @@ -55,9 +57,9 @@ class TestMetaData(unittest.TestCase): md2 = MetaData.get(mod, ops) MetaData.add_named_operand(mod, 'tbaa', md2) - print md2 + print(md2) - print mod + print(mod) if __name__ == '__main__': diff --git a/test/testall.py b/test/testall.py index ed7a8a1..3b5f0c3 100644 --- a/test/testall.py +++ b/test/testall.py @@ -79,9 +79,11 @@ def do_module(): class strstream(object): def __init__(self): - self.s = '' + self.s = b'' def write(self, data): + if not isinstance(data, bytes): + data = data.encode('utf-8') self.s += data def read(self):