Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c6d9eb9

Browse files
committed
Python: Move more tests for argument names into own file
Plus fixup of expected output from unrelated tests
1 parent 3f974fb commit c6d9eb9

3 files changed

Lines changed: 44 additions & 42 deletions

File tree

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
edges
22
| functions_test.py:39:9:39:9 | empty mutable value | functions_test.py:40:5:40:5 | empty mutable value |
33
| functions_test.py:133:15:133:15 | empty mutable value | functions_test.py:134:5:134:5 | empty mutable value |
4-
| functions_test.py:185:25:185:25 | empty mutable value | functions_test.py:186:5:186:5 | empty mutable value |
5-
| functions_test.py:188:21:188:21 | empty mutable value | functions_test.py:189:5:189:5 | empty mutable value |
6-
| functions_test.py:191:27:191:27 | empty mutable value | functions_test.py:192:25:192:25 | empty mutable value |
7-
| functions_test.py:191:27:191:27 | empty mutable value | functions_test.py:193:21:193:21 | empty mutable value |
8-
| functions_test.py:192:25:192:25 | empty mutable value | functions_test.py:185:25:185:25 | empty mutable value |
9-
| functions_test.py:193:21:193:21 | empty mutable value | functions_test.py:188:21:188:21 | empty mutable value |
4+
| functions_test.py:151:25:151:25 | empty mutable value | functions_test.py:152:5:152:5 | empty mutable value |
5+
| functions_test.py:154:21:154:21 | empty mutable value | functions_test.py:155:5:155:5 | empty mutable value |
6+
| functions_test.py:157:27:157:27 | empty mutable value | functions_test.py:158:25:158:25 | empty mutable value |
7+
| functions_test.py:157:27:157:27 | empty mutable value | functions_test.py:159:21:159:21 | empty mutable value |
8+
| functions_test.py:158:25:158:25 | empty mutable value | functions_test.py:151:25:151:25 | empty mutable value |
9+
| functions_test.py:159:21:159:21 | empty mutable value | functions_test.py:154:21:154:21 | empty mutable value |
1010
#select
1111
| functions_test.py:40:5:40:5 | x | functions_test.py:39:9:39:9 | empty mutable value | functions_test.py:40:5:40:5 | empty mutable value | $@ flows to here and is mutated. | functions_test.py:39:9:39:9 | x | Default value |
1212
| functions_test.py:134:5:134:5 | x | functions_test.py:133:15:133:15 | empty mutable value | functions_test.py:134:5:134:5 | empty mutable value | $@ flows to here and is mutated. | functions_test.py:133:15:133:15 | x | Default value |
13-
| functions_test.py:186:5:186:5 | x | functions_test.py:191:27:191:27 | empty mutable value | functions_test.py:186:5:186:5 | empty mutable value | $@ flows to here and is mutated. | functions_test.py:191:27:191:27 | y | Default value |
14-
| functions_test.py:189:5:189:5 | x | functions_test.py:191:27:191:27 | empty mutable value | functions_test.py:189:5:189:5 | empty mutable value | $@ flows to here and is mutated. | functions_test.py:191:27:191:27 | y | Default value |
13+
| functions_test.py:152:5:152:5 | x | functions_test.py:157:27:157:27 | empty mutable value | functions_test.py:152:5:152:5 | empty mutable value | $@ flows to here and is mutated. | functions_test.py:157:27:157:27 | y | Default value |
14+
| functions_test.py:155:5:155:5 | x | functions_test.py:157:27:157:27 | empty mutable value | functions_test.py:155:5:155:5 | empty mutable value | $@ flows to here and is mutated. | functions_test.py:157:27:157:27 | y | Default value |

python/ql/test/query-tests/Functions/general/argument_names.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,39 @@ def s_smethod2(ok):
6666
def s_cmethod2(cls):
6767
pass
6868
s_cmethod2 = classmethod(s_cmethod2)
69+
70+
#Possible FPs for non-self. ODASA-2439
71+
72+
class C(object):
73+
def _func(f):
74+
return f
75+
76+
_func(x)
77+
78+
#or
79+
@_func
80+
def meth(self):
81+
pass
82+
83+
84+
def dont_care(arg):
85+
pass
86+
87+
class C(object):
88+
89+
meth = dont_care
90+
91+
class Meta(type):
92+
93+
#__new__ is an implicit class method, so the first arg is the metaclass
94+
def __new__(metacls, name, bases, cls_dict):
95+
return super(Meta, metacls).__new__(metacls, name, bases, cls_dict)
96+
97+
#ODASA-6062
98+
import zope.interface
99+
class Z(zope.interface.Interface):
100+
101+
def meth(arg):
102+
pass
103+
104+
Z().meth(0)

python/ql/test/query-tests/Functions/general/functions_test.py

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -134,33 +134,6 @@ def augassign(x = []):
134134
x += ["x"]
135135

136136

137-
#Possible FPs for non-self. ODASA-2439
138-
139-
class C(object):
140-
def _func(f):
141-
return f
142-
143-
_func(x)
144-
145-
#or
146-
@_func
147-
def meth(self):
148-
pass
149-
150-
151-
def dont_care(arg):
152-
pass
153-
154-
class C(object):
155-
156-
meth = dont_care
157-
158-
class Meta(type):
159-
160-
#__new__ is an implicit class method, so the first arg is the metaclass
161-
def __new__(metacls, name, bases, cls_dict):
162-
return super(Meta, metacls).__new__(metacls, name, bases, cls_dict)
163-
164137
#ODASA 3658
165138
from sys import exit
166139
#Consistent returns
@@ -172,14 +145,7 @@ def ok5():
172145
print(e)
173146
exit(EXIT_ERROR)
174147

175-
#ODASA-6062
176-
import zope.interface
177-
class Z(zope.interface.Interface):
178-
179-
def meth(arg):
180-
pass
181148

182-
Z().meth(0)
183149

184150
# indirect modification of parameter with default
185151
def aug_assign_argument(x):

0 commit comments

Comments
 (0)