aboutsummaryrefslogtreecommitdiffstats
path: root/tests/samplebinding/enum_test.py
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2011-09-28 17:55:54 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:18:18 -0300
commitb9ab302dd7aff3ecbbbc7ffe1ef2ef0bf4956a5a (patch)
treeb2c62e3ae790b7c5a70f7308282ec2975aa168a2 /tests/samplebinding/enum_test.py
parent6b21c2fa5eeb6a7c7b6533f1c966a47d8ef07e69 (diff)
Fixed tests to work with python3.x and python2.x
Diffstat (limited to 'tests/samplebinding/enum_test.py')
-rw-r--r--tests/samplebinding/enum_test.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/samplebinding/enum_test.py b/tests/samplebinding/enum_test.py
index f81f8b0a8..fefe75ce3 100644
--- a/tests/samplebinding/enum_test.py
+++ b/tests/samplebinding/enum_test.py
@@ -70,12 +70,12 @@ class EnumTest(unittest.TestCase):
def testBuildingEnumWithDefaultValue(self):
'''Enum constructor with default value'''
enum = SampleNamespace.Option()
- self.assertEqual(enum, SampleNamespace.None)
+ self.assertEqual(enum, SampleNamespace.None_)
def testEnumConversionToAndFromPython(self):
'''Conversion of enum objects from Python to C++ back again.'''
enumout = SampleNamespace.enumInEnumOut(SampleNamespace.TwoIn)
- self.assert_(enumout, SampleNamespace.TwoOut)
+ self.assertTrue(enumout, SampleNamespace.TwoOut)
self.assertEqual(repr(enumout), repr(SampleNamespace.TwoOut))
def testEnumConstructorWithTooManyParameters(self):
@@ -105,7 +105,13 @@ class EnumTest(unittest.TestCase):
def testEnumTpPrintImplementation(self):
'''Without SbkEnum.tp_print 'print' returns the enum represented as an int.'''
tmpfile = createTempFile()
- print(Event.ANY_EVENT, file=tmpfile)
+ if IS_PY3K:
+ from py3k import printToFile
+ printToFile(tmpfile, Event.ANY_EVENT)
+ else:
+ sys.stdout = tmpfile
+ print(Event.ANY_EVENT)
+ sys.stdout = sys.__stdout__
tmpfile.seek(0)
text = tmpfile.read().strip()
tmpfile.close()