Home | History | Annotate | Download | only in test
      1 from __future__ import unicode_literals
      2 
      3 import unittest
      4 from test import test_support
      5 
      6 class TestFuture(unittest.TestCase):
      7     def assertType(self, obj, typ):
      8         self.assertTrue(type(obj) is typ,
      9             "type(%r) is %r, not %r" % (obj, type(obj), typ))
     10 
     11     def test_unicode_strings(self):
     12         self.assertType("", unicode)
     13         self.assertType('', unicode)
     14         self.assertType(r"", unicode)
     15         self.assertType(r'', unicode)
     16         self.assertType(""" """, unicode)
     17         self.assertType(''' ''', unicode)
     18         self.assertType(r""" """, unicode)
     19         self.assertType(r''' ''', unicode)
     20         self.assertType(u"", unicode)
     21         self.assertType(u'', unicode)
     22         self.assertType(ur"", unicode)
     23         self.assertType(ur'', unicode)
     24         self.assertType(u""" """, unicode)
     25         self.assertType(u''' ''', unicode)
     26         self.assertType(ur""" """, unicode)
     27         self.assertType(ur''' ''', unicode)
     28 
     29         self.assertType(b"", str)
     30         self.assertType(b'', str)
     31         self.assertType(br"", str)
     32         self.assertType(br'', str)
     33         self.assertType(b""" """, str)
     34         self.assertType(b''' ''', str)
     35         self.assertType(br""" """, str)
     36         self.assertType(br''' ''', str)
     37 
     38         self.assertType('' '', unicode)
     39         self.assertType('' u'', unicode)
     40         self.assertType(u'' '', unicode)
     41         self.assertType(u'' u'', unicode)
     42 
     43 def test_main():
     44     test_support.run_unittest(TestFuture)
     45 
     46 if __name__ == "__main__":
     47     test_main()
     48