cpython/Lib/test/test_future4.py

48 lines
1.5 KiB
Python
Raw Normal View History

2008-03-26 19:55:31 -03:00
from __future__ import unicode_literals
import unittest
from test import test_support
class TestFuture(unittest.TestCase):
def assertType(self, obj, typ):
2009-06-30 19:57:08 -03:00
self.assertTrue(type(obj) is typ,
2008-03-26 19:55:31 -03:00
"type(%r) is %r, not %r" % (obj, type(obj), typ))
def test_unicode_strings(self):
self.assertType("", unicode)
self.assertType('', unicode)
2008-03-26 19:55:31 -03:00
self.assertType(r"", unicode)
self.assertType(r'', unicode)
self.assertType(""" """, unicode)
self.assertType(''' ''', unicode)
self.assertType(r""" """, unicode)
self.assertType(r''' ''', unicode)
2008-03-26 19:55:31 -03:00
self.assertType(u"", unicode)
self.assertType(u'', unicode)
2008-03-26 19:55:31 -03:00
self.assertType(ur"", unicode)
self.assertType(ur'', unicode)
self.assertType(u""" """, unicode)
self.assertType(u''' ''', unicode)
self.assertType(ur""" """, unicode)
self.assertType(ur''' ''', unicode)
2008-03-26 19:55:31 -03:00
self.assertType(b"", str)
self.assertType(b'', str)
2008-03-26 19:55:31 -03:00
self.assertType(br"", str)
self.assertType(br'', str)
self.assertType(b""" """, str)
self.assertType(b''' ''', str)
self.assertType(br""" """, str)
self.assertType(br''' ''', str)
self.assertType('' '', unicode)
self.assertType('' u'', unicode)
self.assertType(u'' '', unicode)
self.assertType(u'' u'', unicode)
2008-03-26 19:55:31 -03:00
def test_main():
test_support.run_unittest(TestFuture)
if __name__ == "__main__":
test_main()