diff --git a/tests/test_basics.py b/tests/test_basics.py index 32f4a98..cea5946 100644 --- a/tests/test_basics.py +++ b/tests/test_basics.py @@ -4,6 +4,13 @@ from __future__ import absolute_import import unittest from jnius.reflect import autoclass +try: + long +except NameError: + # Python 3 + long = int + + class BasicsTest(unittest.TestCase): def test_static_methods(self): @@ -102,7 +109,7 @@ class BasicsTest(unittest.TestCase): self.assertEquals(test.methodParamsZBCSIJFD( True, 127, 'k', 32767, 2147483467, 9223372036854775807, 1.23456789, 1.23456789), True) self.assertEquals(test.methodParamsZBCSIJFD( - True, 127L, 'k', 32767L, 2147483467L, 9223372036854775807, 1.23456789, 1.23456789), True) + True, long(127), 'k', long(32767), long(2147483467), 9223372036854775807, 1.23456789, 1.23456789), True) self.assertEquals(test.methodParamsString('helloworld'), True) self.assertEquals(test.methodParamsArrayI([1, 2, 3]), True) self.assertEquals(test.methodParamsArrayString([ diff --git a/tests/test_method_multiple_signatures.py b/tests/test_method_multiple_signatures.py index 2e03903..ba23304 100644 --- a/tests/test_method_multiple_signatures.py +++ b/tests/test_method_multiple_signatures.py @@ -4,6 +4,13 @@ from __future__ import absolute_import import unittest from jnius.reflect import autoclass +try: + long +except NameError: + # Python 3 + long = int + + class MultipleSignature(unittest.TestCase): def test_multiple_constructors(self): @@ -46,7 +53,7 @@ class MultipleSignature(unittest.TestCase): def test_multiple_methods_varargs_long(self): MultipleMethods = autoclass('org.jnius.MultipleMethods') - self.assertEqual(MultipleMethods.resolve(1L, 2L, 3L), 'resolved varargs') + self.assertEqual(MultipleMethods.resolve(long(1), long(2), long(3)), 'resolved varargs') def test_multiple_methods_two_args_and_varargs(self): MultipleMethods = autoclass('org.jnius.MultipleMethods') @@ -55,7 +62,7 @@ class MultipleSignature(unittest.TestCase): def test_multiple_methods_one_int_one_small_long_and_a_string(self): MultipleMethods = autoclass('org.jnius.MultipleMethods') self.assertEqual(MultipleMethods.resolve( - 1, 1L, "one"), "resolved one int, one long and a string") + 1, long(1), "one"), "resolved one int, one long and a string") def test_multiple_methods_one_int_one_actual_long_and_a_string(self): MultipleMethods = autoclass('org.jnius.MultipleMethods')