summaryrefslogtreecommitdiff
path: root/test/functional/anomalous_unicode_escape.py
blob: 19a691200caa31718e94d207b3157470f69950b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# pylint:disable=W0105, W0511, C0121
"""Test for backslash escapes in byte vs unicode strings"""

# Would be valid in Unicode, but probably not what you want otherwise
BAD_UNICODE = b'\u0042'  # [anomalous-unicode-escape-in-string]
BAD_LONG_UNICODE = b'\U00000042'  # [anomalous-unicode-escape-in-string]
# +1:[anomalous-unicode-escape-in-string]
BAD_NAMED_UNICODE = b'\N{GREEK SMALL LETTER ALPHA}'

GOOD_UNICODE = u'\u0042'
GOOD_LONG_UNICODE = u'\U00000042'
GOOD_NAMED_UNICODE = u'\N{GREEK SMALL LETTER ALPHA}'


# Valid raw strings
RAW_BACKSLASHES = r'raw'
RAW_UNICODE = ur"\u0062\n"

# In a comment you can have whatever you want: \ \\ \n \m
# even things that look like bad strings: "C:\Program Files"