Update tests

This commit is contained in:
Joe Farebrother
2025-06-13 11:16:54 +01:00
parent 2c8896848f
commit 547c03cee6
3 changed files with 11 additions and 4 deletions

View File

@@ -4,7 +4,7 @@ ql/python/ql/src/Classes/EqualsOrHash.ql
ql/python/ql/src/Classes/EqualsOrNotEquals.ql
ql/python/ql/src/Classes/IncompleteOrdering.ql
ql/python/ql/src/Classes/InconsistentMRO.ql
ql/python/ql/src/Classes/InitCallsSubclassMethod.ql
ql/python/ql/src/Classes/InitCallsSubclass/InitCallsSubclassMethod.ql
ql/python/ql/src/Classes/MissingCallToDel.ql
ql/python/ql/src/Classes/MissingCallToInit.ql
ql/python/ql/src/Classes/MutatingDescriptor.ql

View File

@@ -1 +1,2 @@
| 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 |
| 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 |

View File

@@ -23,19 +23,25 @@ def bad1():
if self.important_state == "OK":
pass
def good2():
def bad2():
class Super:
def __init__(self, arg):
self.a = arg
self.postproc() # OK: Here `postproc` is called after initialisation.
# BAD: postproc is called after initialization. This is still an issue
# since it may still occur before all initialization on a subclass is complete.
self.postproc()
def postproc(self):
if self.a == 1:
pass
class Sub(Super):
def __init__(self, arg):
super().__init__(arg)
self.b = 3
def postproc(self):
if self.a == 2:
if self.a == 2 and self.b == 3:
pass
def good3():