Fix a couple of tests for Python 3
This commit is contained in:
parent
aba3e208d2
commit
87ffb437d8
2 changed files with 8 additions and 4 deletions
|
|
@ -1,3 +1,5 @@
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from llvm.core import *
|
from llvm.core import *
|
||||||
|
|
@ -47,7 +49,7 @@ class TestMetaData(unittest.TestCase):
|
||||||
ops = [MetaDataString.get(mod, "int"), root]
|
ops = [MetaDataString.get(mod, "int"), root]
|
||||||
md1 = MetaData.get(mod, ops)
|
md1 = MetaData.get(mod, ops)
|
||||||
MetaData.add_named_operand(mod, 'tbaa', md1)
|
MetaData.add_named_operand(mod, 'tbaa', md1)
|
||||||
print md1
|
print(md1)
|
||||||
|
|
||||||
ops = [MetaDataString.get(mod, "const float"),
|
ops = [MetaDataString.get(mod, "const float"),
|
||||||
root,
|
root,
|
||||||
|
|
@ -55,9 +57,9 @@ class TestMetaData(unittest.TestCase):
|
||||||
|
|
||||||
md2 = MetaData.get(mod, ops)
|
md2 = MetaData.get(mod, ops)
|
||||||
MetaData.add_named_operand(mod, 'tbaa', md2)
|
MetaData.add_named_operand(mod, 'tbaa', md2)
|
||||||
print md2
|
print(md2)
|
||||||
|
|
||||||
print mod
|
print(mod)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
||||||
|
|
@ -79,9 +79,11 @@ def do_module():
|
||||||
|
|
||||||
class strstream(object):
|
class strstream(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.s = ''
|
self.s = b''
|
||||||
|
|
||||||
def write(self, data):
|
def write(self, data):
|
||||||
|
if not isinstance(data, bytes):
|
||||||
|
data = data.encode('utf-8')
|
||||||
self.s += data
|
self.s += data
|
||||||
|
|
||||||
def read(self):
|
def read(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue