All Downloads are FREE. Search and download functionalities are using the official Maven repository.

Lib.test.test_long_jy.py Maven / Gradle / Ivy

Go to download

Jython is an implementation of the high-level, dynamic, object-oriented language Python written in 100% Pure Java, and seamlessly integrated with the Java platform. It thus allows you to run Python on any Java platform.

There is a newer version: 2.7.4
Show newest version
"""Misc long tests

Made for Jython.
"""
from test import test_support
import unittest

class MyLong(long):
    pass


class LongTestCase(unittest.TestCase):

    def _test_long_repr(self, type2test):
        val = type2test(42)
        self.assertEqual(str(val), '42')
        self.assertEqual(repr(val), '42L')

    def test_long_repr(self):
        self._test_long_repr(long)

    def test_long_subclass_repr(self):
        self._test_long_repr(MyLong)

    def test_subclass_bool(self):
        # http://bugs.jython.org/issue1828
        self.assertTrue(bool(MyLong(42)))


def test_main():
    test_support.run_unittest(LongTestCase)

if __name__ == '__main__':
    test_main()




© 2015 - 2024 Weber Informatics LLC | Privacy Policy