python: update comments

This commit is contained in:
Rasmus Lerchedahl Petersen
2023-05-03 18:10:15 +02:00
parent e49f7a5d33
commit 6d9fd24f1b
2 changed files with 6 additions and 2 deletions

View File

@@ -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.

View File

@@ -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