summaryrefslogtreecommitdiff
path: root/lib/python2.7/test/test_future4.py
blob: 53f8adde228ad8ac01d2af051947c6a0a70da499 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from __future__ import unicode_literals

import unittest
from test import test_support

class TestFuture(unittest.TestCase):
    def assertType(self, obj, typ):
        self.assertTrue(type(obj) is typ,
            "type(%r) is %r, not %r" % (obj, type(obj), typ))

    def test_unicode_strings(self):
        self.assertType("", unicode)
        self.assertType('', unicode)
        self.assertType(r"", unicode)
        self.assertType(r'', unicode)
        self.assertType(""" """, unicode)
        self.assertType(''' ''', unicode)
        self.assertType(r""" """, unicode)
        self.assertType(r''' ''', unicode)
        self.assertType(u"", unicode)
        self.assertType(u'', unicode)
        self.assertType(ur"", unicode)
        self.assertType(ur'', unicode)
        self.assertType(u""" """, unicode)
        self.assertType(u''' ''', unicode)
        self.assertType(ur""" """, unicode)
        self.assertType(ur''' ''', unicode)

        self.assertType(b"", str)
        self.assertType(b'', str)
        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)

def test_main():
    test_support.run_unittest(TestFuture)

if __name__ == "__main__":
    test_main()