summaryrefslogtreecommitdiff
path: root/testing/support.py
blob: 17c56cdc91c408f815c456673f2f13e34cc39fd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import sys

if sys.version_info < (3,):
    __all__ = ['u']

    class U(object):
        def __add__(self, other):
            return eval('u'+repr(other).replace(r'\\u', r'\u')
                                       .replace(r'\\U', r'\U'))
    u = U()
    assert u+'a\x00b' == eval(r"u'a\x00b'")
    assert u+'a\u1234b' == eval(r"u'a\u1234b'")
    assert u+'a\U00012345b' == eval(r"u'a\U00012345b'")

else:
    __all__ = ['u', 'unicode', 'long']
    u = ""
    unicode = str
    long = int