Commit 8e5578e6 authored by Stefan Behnel's avatar Stefan Behnel

extended test case on string literals

parent f84485ab
__doc__ = ur""" __doc__ = ur"""
>>> s1 >>> s1
b'abc\x11' b'abc\x11'
>>> s1 == b'abc\x11'
True
>>> len(s1) >>> len(s1)
4 4
>>> s2 >>> s2
b'abc\\x11' b'abc\\x11'
>>> s2 == br'abc\x11'
True
>>> len(s2) >>> len(s2)
7 7
>>> s3 >>> s3
b'abc\\x11' b'abc\\x11'
>>> s3 == bR'abc\x11'
True
>>> len(s3) >>> len(s3)
7 7
>>> s4 >>> s4
b'abc\x11' b'abc\x11'
>>> s4 == b'abc\x11'
True
>>> len(s4) >>> len(s4)
4 4
>>> s5 >>> s5
b'abc\x11' b'abc\x11'
>>> s5 == B'abc\x11'
True
>>> len(s5) >>> len(s5)
4 4
>>> s6 >>> s6
b'abc\\x11' b'abc\\x11'
>>> s6 == br'abc\x11'
True
>>> len(s6) >>> len(s6)
7 7
>>> s7 >>> s7
b'abc\\x11' b'abc\\x11'
>>> s7 == Br'abc\x11'
True
>>> len(s7) >>> len(s7)
7 7
>>> s8 >>> s8
b'abc\\x11' b'abc\\x11'
>>> s8 == bR'abc\x11'
True
>>> len(s8) >>> len(s8)
7 7
>>> s9
b'abc\\x11'
>>> s9 == BR'abc\x11'
True
>>> len(s9)
7
>>> u1 >>> u1
u'abc\x11' u'abc\x11'
>>> u1 == u'abc\x11'
True
>>> len(u1) >>> len(u1)
4 4
>>> u2 >>> u2
u'abc\x11' u'abc\x11'
>>> u2 == U'abc\x11'
True
>>> len(u2) >>> len(u2)
4 4
>>> u3 >>> u3
u'abc\\x11' u'abc\\x11'
>>> u3 == ur'abc\x11'
True
>>> len(u3) >>> len(u3)
7 7
>>> u4 >>> u4
u'abc\\x11' u'abc\\x11'
>>> u4 == Ur'abc\x11'
True
>>> len(u4) >>> len(u4)
7 7
>>> u5 >>> u5
u'abc\\x11' u'abc\\x11'
>>> u5 == uR'abc\x11'
True
>>> len(u5) >>> len(u5)
7 7
>>> u6
u'abc\\x11'
>>> u6 == UR'abc\x11'
True
>>> len(u6)
7
""" """
import sys import sys
if sys.version_info[0] >= 3: if sys.version_info[0] >= 3:
__doc__ = __doc__.replace(u" u'", u" '") __doc__ = __doc__.replace(u" u'", u" '").replace(u" U'", u" '").replace(u" ur'", u" r'").replace(u" uR'", u" R'").replace(u" Ur'", u" r'").replace(u" UR'", u" R'")
else: else:
__doc__ = __doc__.replace(u" b'", u" '") __doc__ = __doc__.replace(u" b'", u" '").replace(u" B'", u" '").replace(u" br'", u" r'").replace(u" bR'", u" R'").replace(u" Br'", u" r'").replace(u" BR'", u" R'")
s1 = "abc\x11" s1 = "abc\x11"
s2 = r"abc\x11" s2 = r"abc\x11"
...@@ -79,9 +119,11 @@ s5 = B"abc\x11" ...@@ -79,9 +119,11 @@ s5 = B"abc\x11"
s6 = br"abc\x11" s6 = br"abc\x11"
s7 = Br"abc\x11" s7 = Br"abc\x11"
s8 = bR"abc\x11" s8 = bR"abc\x11"
s9 = BR"abc\x11"
u1 = u"abc\x11" u1 = u"abc\x11"
u2 = U"abc\x11" u2 = U"abc\x11"
u3 = ur"abc\x11" u3 = ur"abc\x11"
u4 = Ur"abc\x11" u4 = Ur"abc\x11"
u5 = uR"abc\x11" u5 = uR"abc\x11"
u6 = UR"abc\x11"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment