mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
python: update comments
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# Here we test writing to a captured variable via the `nonlocal` keyword (see `out`).
|
||||
# Here we test writing to a captured global variable via the `global` keyword (see `out`).
|
||||
# We also test reading one captured variable and writing the value to another (see `through`).
|
||||
|
||||
# All functions starting with "test_" should run and execute `print("OK")` exactly once.
|
||||
|
||||
@@ -13,7 +13,11 @@ def func():
|
||||
|
||||
def other_func():
|
||||
print(Foo) #$ use=moduleImport("foo").getMember("A").getASubclass() use=moduleImport("foo").getMember("B").getASubclass()
|
||||
print(Bar) #$ use=moduleImport("foo").getMember("B").getASubclass() MISSING: use=moduleImport("foo").getMember("A").getASubclass() The MISSING here is documenting correct behaviour
|
||||
# On the next line, we wish to express that it is not possible for `Bar` to be a subclass of `A`.
|
||||
# However, we have no "true negative" annotation, so we use the MISSING annotation instead.
|
||||
# (Normally, "true negative" is not needed as all applicable annotations must be present,
|
||||
# but for type tracking tests, this would be excessive.)
|
||||
print(Bar) #$ use=moduleImport("foo").getMember("B").getASubclass() MISSING: use=moduleImport("foo").getMember("A").getASubclass()
|
||||
print(Baz) #$ use=moduleImport("foo").getMember("B").getASubclass() SPURIOUS: use=moduleImport("foo").getMember("A").getASubclass()
|
||||
|
||||
class Baz(B): pass
|
||||
|
||||
Reference in New Issue
Block a user