pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/MagicStack/MagicPython/commit/96f72cc4ca760894719df4e6c1f9b77977bd0edb

a.css" /> Update tests to have strings as part of expressions. · MagicStack/MagicPython@96f72cc · GitHub
Skip to content

Commit 96f72cc

Browse files
committed
Update tests to have strings as part of expressions.
Statement-level strings are potentially docstrings and may have different meaning.
1 parent 73c3d1e commit 96f72cc

25 files changed

+481
-183
lines changed

test/docstrings/def1.py

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
'TEST'
2+
3+
class Foo:
4+
'TEST'
5+
6+
def foo(self, a:'TEST')
7+
-> 'TEST':
8+
'TEST'
9+
with bar:
10+
pass
11+
12+
def bar(self, a:'TEST')
13+
-> 'TEST': pass
14+
'TEST'
15+
with bar:
16+
pass
17+
18+
19+
20+
21+
22+
' : punctuation.definition.string.begin.python, source.python, string.quoted.single.single.python
23+
TEST : source.python, string.quoted.single.single.python
24+
' : punctuation.definition.string.end.python, source.python, string.quoted.single.single.python
25+
: source.python
26+
class : meta.class.python, source.python, storage.type.class.python
27+
: meta.class.python, source.python
28+
Foo : entity.name.type.class.python, meta.class.python, source.python
29+
: : meta.class.python, punctuation.section.class.begin.python, source.python
30+
: source.python
31+
' : punctuation.definition.string.begin.python, source.python, string.quoted.single.single.python
32+
TEST : source.python, string.quoted.single.single.python
33+
' : punctuation.definition.string.end.python, source.python, string.quoted.single.single.python
34+
: source.python
35+
: meta.function.python, source.python
36+
def : meta.function.python, source.python, storage.type.function.python
37+
: meta.function.python, source.python
38+
foo : entity.name.function.python, meta.function.python, source.python
39+
( : meta.function.parameters.python, meta.function.python, punctuation.definition.parameters.begin.python, source.python
40+
self : meta.function.parameters.python, meta.function.python, source.python, variable.parameter.function.language.pyhton
41+
, : meta.function.parameters.python, meta.function.python, punctuation.separator.parameters.python, source.python
42+
: meta.function.parameters.python, meta.function.python, source.python
43+
a : meta.function.parameters.python, meta.function.python, source.python, variable.parameter.function.language.pyhton
44+
: : meta.function.parameters.python, meta.function.python, punctuation.separator.annotation.python, source.python
45+
' : meta.function.parameters.python, meta.function.python, punctuation.definition.string.begin.python, source.python, string.quoted.single.single.python
46+
TEST : meta.function.parameters.python, meta.function.python, source.python, string.quoted.single.single.python
47+
' : meta.function.parameters.python, meta.function.python, punctuation.definition.string.end.python, source.python, string.quoted.single.single.python
48+
) : meta.function.parameters.python, meta.function.python, punctuation.definition.parameters.end.python, source.python
49+
: meta.function.python, source.python
50+
-> : meta.function.python, punctuation.separator.annotation.result.python, source.python
51+
: meta.function.python, source.python
52+
' : meta.function.python, punctuation.definition.string.begin.python, source.python, string.quoted.single.single.python
53+
TEST : meta.function.python, source.python, string.quoted.single.single.python
54+
' : meta.function.python, punctuation.definition.string.end.python, source.python, string.quoted.single.single.python
55+
: : meta.function.python, punctuation.section.function.begin.python, source.python
56+
: source.python
57+
' : punctuation.definition.string.begin.python, source.python, string.quoted.single.single.python
58+
TEST : source.python, string.quoted.single.single.python
59+
' : punctuation.definition.string.end.python, source.python, string.quoted.single.single.python
60+
: source.python
61+
with : keyword.control.flow.python, source.python
62+
bar: : source.python
63+
: source.python
64+
pass : keyword.control.flow.python, source.python
65+
: source.python
66+
: meta.function.python, source.python
67+
def : meta.function.python, source.python, storage.type.function.python
68+
: meta.function.python, source.python
69+
bar : entity.name.function.python, meta.function.python, source.python
70+
( : meta.function.parameters.python, meta.function.python, punctuation.definition.parameters.begin.python, source.python
71+
self : meta.function.parameters.python, meta.function.python, source.python, variable.parameter.function.language.pyhton
72+
, : meta.function.parameters.python, meta.function.python, punctuation.separator.parameters.python, source.python
73+
: meta.function.parameters.python, meta.function.python, source.python
74+
a : meta.function.parameters.python, meta.function.python, source.python, variable.parameter.function.language.pyhton
75+
: : meta.function.parameters.python, meta.function.python, punctuation.separator.annotation.python, source.python
76+
' : meta.function.parameters.python, meta.function.python, punctuation.definition.string.begin.python, source.python, string.quoted.single.single.python
77+
TEST : meta.function.parameters.python, meta.function.python, source.python, string.quoted.single.single.python
78+
' : meta.function.parameters.python, meta.function.python, punctuation.definition.string.end.python, source.python, string.quoted.single.single.python
79+
) : meta.function.parameters.python, meta.function.python, punctuation.definition.parameters.end.python, source.python
80+
: meta.function.python, source.python
81+
-> : meta.function.python, punctuation.separator.annotation.result.python, source.python
82+
: meta.function.python, source.python
83+
' : meta.function.python, punctuation.definition.string.begin.python, source.python, string.quoted.single.single.python
84+
TEST : meta.function.python, source.python, string.quoted.single.single.python
85+
' : meta.function.python, punctuation.definition.string.end.python, source.python, string.quoted.single.single.python
86+
: : meta.function.python, punctuation.section.function.begin.python, source.python
87+
: source.python
88+
pass : keyword.control.flow.python, source.python
89+
: source.python
90+
' : punctuation.definition.string.begin.python, source.python, string.quoted.single.single.python
91+
TEST : source.python, string.quoted.single.single.python
92+
' : punctuation.definition.string.end.python, source.python, string.quoted.single.single.python
93+
: source.python
94+
with : keyword.control.flow.python, source.python
95+
bar: : source.python
96+
: source.python
97+
pass : keyword.control.flow.python, source.python

test/regexp/python2.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
r'
1+
a = r'
22
(?x)
33
foo
44
'
55

66

77

8+
a : source.python
9+
= : keyword.operator.assignment.python, source.python
10+
: source.python
811
r : source.python, storage.type.string.python, string.regexp.quoted.single.python
912
' : punctuation.definition.string.begin.python, source.python, string.regexp.quoted.single.python
1013
: invalid.illegal.newline.python, source.python, string.regexp.quoted.single.python

test/regexp/python3.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,65 @@
1-
r'''
1+
a = r'''
22
(?x)
33
foo
44
'''
5-
br'''
5+
a = br'''
66
(?x)
77
foo
88
'''
9-
rb'''
9+
a = rb'''
1010
(?x)
1111
foo
1212
'''
13-
Br'''
13+
a = Br'''
1414
(?x)
1515
foo
1616
'''
17-
rB'''
17+
a = rB'''
1818
(?x)
1919
foo
2020
'''
2121

2222

2323

24+
a : source.python
25+
= : keyword.operator.assignment.python, source.python
26+
: source.python
2427
r : source.python, storage.type.string.python, string.regexp.quoted.triple.python
2528
''' : punctuation.definition.string.begin.python, source.python, string.regexp.quoted.triple.python
2629
: source.python, string.regexp.quoted.triple.python
2730
(?x) : source.python, storage.modifier.flag.regexp, string.regexp.quoted.triple.python
2831
foo : source.python, string.regexp.quoted.triple.python
2932
''' : punctuation.definition.string.end.python, source.python, string.regexp.quoted.triple.python
33+
a : source.python
34+
= : keyword.operator.assignment.python, source.python
35+
: source.python
3036
br : source.python, storage.type.string.python, string.regexp.quoted.triple.python
3137
''' : punctuation.definition.string.begin.python, source.python, string.regexp.quoted.triple.python
3238
: source.python, string.regexp.quoted.triple.python
3339
(?x) : source.python, storage.modifier.flag.regexp, string.regexp.quoted.triple.python
3440
foo : source.python, string.regexp.quoted.triple.python
3541
''' : punctuation.definition.string.end.python, source.python, string.regexp.quoted.triple.python
42+
a : source.python
43+
= : keyword.operator.assignment.python, source.python
44+
: source.python
3645
rb : source.python, storage.type.string.python, string.regexp.quoted.triple.python
3746
''' : punctuation.definition.string.begin.python, source.python, string.regexp.quoted.triple.python
3847
: source.python, string.regexp.quoted.triple.python
3948
(?x) : source.python, storage.modifier.flag.regexp, string.regexp.quoted.triple.python
4049
foo : source.python, string.regexp.quoted.triple.python
4150
''' : punctuation.definition.string.end.python, source.python, string.regexp.quoted.triple.python
51+
a : source.python
52+
= : keyword.operator.assignment.python, source.python
53+
: source.python
4254
Br : source.python, storage.type.string.python, string.regexp.quoted.triple.python
4355
''' : punctuation.definition.string.begin.python, source.python, string.regexp.quoted.triple.python
4456
: source.python, string.regexp.quoted.triple.python
4557
(?x) : source.python, storage.modifier.flag.regexp, string.regexp.quoted.triple.python
4658
foo : source.python, string.regexp.quoted.triple.python
4759
''' : punctuation.definition.string.end.python, source.python, string.regexp.quoted.triple.python
60+
a : source.python
61+
= : keyword.operator.assignment.python, source.python
62+
: source.python
4863
rB : source.python, storage.type.string.python, string.regexp.quoted.triple.python
4964
''' : punctuation.definition.string.begin.python, source.python, string.regexp.quoted.triple.python
5065
: source.python, string.regexp.quoted.triple.python

test/regexp/python4.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,65 @@
1-
r"""
1+
a = r"""
22
(?x)
33
foo
44
"""
5-
br"""
5+
a = br"""
66
(?x)
77
foo
88
"""
9-
rb"""
9+
a = rb"""
1010
(?x)
1111
foo
1212
"""
13-
Br"""
13+
a = Br"""
1414
(?x)
1515
foo
1616
"""
17-
rB"""
17+
a = rB"""
1818
(?x)
1919
foo
2020
"""
2121

2222

2323

24+
a : source.python
25+
= : keyword.operator.assignment.python, source.python
26+
: source.python
2427
r : source.python, storage.type.string.python, string.regexp.quoted.triple.python
2528
""" : punctuation.definition.string.begin.python, source.python, string.regexp.quoted.triple.python
2629
: source.python, string.regexp.quoted.triple.python
2730
(?x) : source.python, storage.modifier.flag.regexp, string.regexp.quoted.triple.python
2831
foo : source.python, string.regexp.quoted.triple.python
2932
""" : punctuation.definition.string.end.python, source.python, string.regexp.quoted.triple.python
33+
a : source.python
34+
= : keyword.operator.assignment.python, source.python
35+
: source.python
3036
br : source.python, storage.type.string.python, string.regexp.quoted.triple.python
3137
""" : punctuation.definition.string.begin.python, source.python, string.regexp.quoted.triple.python
3238
: source.python, string.regexp.quoted.triple.python
3339
(?x) : source.python, storage.modifier.flag.regexp, string.regexp.quoted.triple.python
3440
foo : source.python, string.regexp.quoted.triple.python
3541
""" : punctuation.definition.string.end.python, source.python, string.regexp.quoted.triple.python
42+
a : source.python
43+
= : keyword.operator.assignment.python, source.python
44+
: source.python
3645
rb : source.python, storage.type.string.python, string.regexp.quoted.triple.python
3746
""" : punctuation.definition.string.begin.python, source.python, string.regexp.quoted.triple.python
3847
: source.python, string.regexp.quoted.triple.python
3948
(?x) : source.python, storage.modifier.flag.regexp, string.regexp.quoted.triple.python
4049
foo : source.python, string.regexp.quoted.triple.python
4150
""" : punctuation.definition.string.end.python, source.python, string.regexp.quoted.triple.python
51+
a : source.python
52+
= : keyword.operator.assignment.python, source.python
53+
: source.python
4254
Br : source.python, storage.type.string.python, string.regexp.quoted.triple.python
4355
""" : punctuation.definition.string.begin.python, source.python, string.regexp.quoted.triple.python
4456
: source.python, string.regexp.quoted.triple.python
4557
(?x) : source.python, storage.modifier.flag.regexp, string.regexp.quoted.triple.python
4658
foo : source.python, string.regexp.quoted.triple.python
4759
""" : punctuation.definition.string.end.python, source.python, string.regexp.quoted.triple.python
60+
a : source.python
61+
= : keyword.operator.assignment.python, source.python
62+
: source.python
4863
rB : source.python, storage.type.string.python, string.regexp.quoted.triple.python
4964
""" : punctuation.definition.string.begin.python, source.python, string.regexp.quoted.triple.python
5065
: source.python, string.regexp.quoted.triple.python

test/regexp/python5.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
1-
r'foo#not a comment'
2-
r'''
1+
a = r'foo#not a comment'
2+
a = r'''
33
(?x) # multi-line regexp
44
foo # comment
55
'''
6-
R'''
6+
a = R'''
77
(?x) # not a
88
foo # comment
99
'''
1010

1111

1212

13+
a : source.python
14+
= : keyword.operator.assignment.python, source.python
15+
: source.python
1316
r : source.python, storage.type.string.python, string.regexp.quoted.single.python
1417
' : punctuation.definition.string.begin.python, source.python, string.regexp.quoted.single.python
1518
foo#not a comment : source.python, string.regexp.quoted.single.python
1619
' : punctuation.definition.string.end.python, source.python, string.regexp.quoted.single.python
20+
a : source.python
21+
= : keyword.operator.assignment.python, source.python
22+
: source.python
1723
r : source.python, storage.type.string.python, string.regexp.quoted.triple.python
1824
''' : punctuation.definition.string.begin.python, source.python, string.regexp.quoted.triple.python
1925
: source.python, string.regexp.quoted.triple.python
@@ -25,6 +31,9 @@
2531
# : comment.line.number-sign.python, punctuation.definition.comment.python, source.python, string.regexp.quoted.triple.python
2632
comment : comment.line.number-sign.python, source.python, string.regexp.quoted.triple.python
2733
''' : punctuation.definition.string.end.python, source.python, string.regexp.quoted.triple.python
34+
a : source.python
35+
= : keyword.operator.assignment.python, source.python
36+
: source.python
2837
R : source.python, storage.type.string.python, string.quoted.single.multi.raw.python
2938
''' : punctuation.definition.string.begin.python, source.python, string.quoted.single.multi.raw.python
3039
(?x) # not a : source.python, string.quoted.single.multi.raw.python

test/regexp/python6.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
1-
r"foo#not a comment"
2-
r"""
1+
a = r"foo#not a comment"
2+
a = r"""
33
(?x) # multi-line regexp
44
foo # comment
55
"""
6-
R"""
6+
a = R"""
77
(?x) # not a
88
foo # comment
99
"""
1010

1111

1212

13+
a : source.python
14+
= : keyword.operator.assignment.python, source.python
15+
: source.python
1316
r : source.python, storage.type.string.python, string.regexp.quoted.double.python
1417
" : punctuation.definition.string.begin.python, source.python, string.regexp.quoted.double.python
1518
foo#not a comment : source.python, string.regexp.quoted.double.python
1619
" : punctuation.definition.string.end.python, source.python, string.regexp.quoted.double.python
20+
a : source.python
21+
= : keyword.operator.assignment.python, source.python
22+
: source.python
1723
r : source.python, storage.type.string.python, string.regexp.quoted.triple.python
1824
""" : punctuation.definition.string.begin.python, source.python, string.regexp.quoted.triple.python
1925
: source.python, string.regexp.quoted.triple.python
@@ -25,6 +31,9 @@
2531
# : comment.line.number-sign.python, punctuation.definition.comment.python, source.python, string.regexp.quoted.triple.python
2632
comment : comment.line.number-sign.python, source.python, string.regexp.quoted.triple.python
2733
""" : punctuation.definition.string.end.python, source.python, string.regexp.quoted.triple.python
34+
a : source.python
35+
= : keyword.operator.assignment.python, source.python
36+
: source.python
2837
R : source.python, storage.type.string.python, string.quoted.double.multi.raw.python
2938
""" : punctuation.definition.string.begin.python, source.python, string.quoted.double.multi.raw.python
3039
(?x) # not a : source.python, string.quoted.double.multi.raw.python

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy