Skip to content

Commit 547c03c

Browse files
Update tests
1 parent 2c88968 commit 547c03c

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

python/ql/integration-tests/query-suite/python-security-and-quality.qls.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ql/python/ql/src/Classes/EqualsOrHash.ql
44
ql/python/ql/src/Classes/EqualsOrNotEquals.ql
55
ql/python/ql/src/Classes/IncompleteOrdering.ql
66
ql/python/ql/src/Classes/InconsistentMRO.ql
7-
ql/python/ql/src/Classes/InitCallsSubclassMethod.ql
7+
ql/python/ql/src/Classes/InitCallsSubclass/InitCallsSubclassMethod.ql
88
ql/python/ql/src/Classes/MissingCallToDel.ql
99
ql/python/ql/src/Classes/MissingCallToInit.ql
1010
ql/python/ql/src/Classes/MutatingDescriptor.ql
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
| init_calls_subclass.py:8:13:8:28 | ControlFlowNode for Attribute() | This call to $@ in an initialization method is overridden by $@. | init_calls_subclass.py:11:9:11:30 | Function set_up | bad1.Super.set_up | init_calls_subclass.py:20:9:20:30 | Function set_up | bad1.Sub.set_up |
2+
| init_calls_subclass.py:32:13:32:27 | ControlFlowNode for Attribute() | This call to $@ in an initialization method is overridden by $@. | init_calls_subclass.py:34:9:34:27 | Function postproc | bad2.Super.postproc | init_calls_subclass.py:43:9:43:27 | Function postproc | bad2.Sub.postproc |

python/ql/test/query-tests/Classes/init-calls-subclass-method/init_calls_subclass.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,25 @@ def set_up(self, arg):
2323
if self.important_state == "OK":
2424
pass
2525

26-
def good2():
26+
def bad2():
2727
class Super:
2828
def __init__(self, arg):
2929
self.a = arg
30-
self.postproc() # OK: Here `postproc` is called after initialisation.
30+
# BAD: postproc is called after initialization. This is still an issue
31+
# since it may still occur before all initialization on a subclass is complete.
32+
self.postproc()
3133

3234
def postproc(self):
3335
if self.a == 1:
3436
pass
3537

3638
class Sub(Super):
39+
def __init__(self, arg):
40+
super().__init__(arg)
41+
self.b = 3
42+
3743
def postproc(self):
38-
if self.a == 2:
44+
if self.a == 2 and self.b == 3:
3945
pass
4046

4147
def good3():

0 commit comments

Comments
 (0)