diff options
author | Renato Filho <renato.filho@openbossa.org> | 2011-09-28 17:55:54 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:18:18 -0300 |
commit | b9ab302dd7aff3ecbbbc7ffe1ef2ef0bf4956a5a (patch) | |
tree | b2c62e3ae790b7c5a70f7308282ec2975aa168a2 /tests/samplebinding/implicitconv_numerical_test.py | |
parent | 6b21c2fa5eeb6a7c7b6533f1c966a47d8ef07e69 (diff) |
Fixed tests to work with python3.x and python2.x
Diffstat (limited to 'tests/samplebinding/implicitconv_numerical_test.py')
-rw-r--r-- | tests/samplebinding/implicitconv_numerical_test.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/tests/samplebinding/implicitconv_numerical_test.py b/tests/samplebinding/implicitconv_numerical_test.py index 06a7c2c27..c5c082ccb 100644 --- a/tests/samplebinding/implicitconv_numerical_test.py +++ b/tests/samplebinding/implicitconv_numerical_test.py @@ -29,6 +29,10 @@ import unittest import sys import sample +from py3kcompat import IS_PY3K, l, long + +if IS_PY3K: + sys.maxint = sys.maxsize class NumericTester(unittest.TestCase): @@ -107,27 +111,27 @@ class LongImplicitConvert(NumericTester): def testLongAsInt(self): '''Long as Int''' - self.check_value(24224l, 24224, sample.acceptInt, int) + self.check_value(l(24224), 24224, sample.acceptInt, int) self.assertRaises(OverflowError, sample.acceptInt, sys.maxint + 20) def testLongAsLong(self): '''Long as Long''' - self.check_value(2405l, 2405, sample.acceptLong, int) + self.check_value(l(2405), 2405, sample.acceptLong, int) self.assertRaises(OverflowError, sample.acceptLong, sys.maxint + 20) def testLongAsUInt(self): '''Long as unsigned Int''' - self.check_value(260l, 260, sample.acceptUInt, long) + self.check_value(l(260), 260, sample.acceptUInt, long) self.assertRaises(OverflowError, sample.acceptUInt, -42) def testLongAsULong(self): '''Long as unsigned Long''' - self.check_value(128l, 128, sample.acceptULong, long) - self.assertRaises(OverflowError, sample.acceptULong, -334l) + self.check_value(l(128), 128, sample.acceptULong, long) + self.assertRaises(OverflowError, sample.acceptULong, l(-334)) def testLongAsDouble(self): '''Float as double''' - self.check_value(42l, 42, sample.acceptDouble, float) + self.check_value(l(42), 42, sample.acceptDouble, float) if __name__ == '__main__': |