mirror of
https://github.com/github/codeql.git
synced 2026-04-26 01:05:15 +02:00
Python: Expand contextmanager test even more
This commit is contained in:
@@ -215,6 +215,7 @@ def test_yield():
|
||||
|
||||
# see https://docs.python.org/3.11/library/contextlib.html#contextlib.contextmanager
|
||||
from contextlib import contextmanager
|
||||
import contextlib
|
||||
|
||||
@contextmanager
|
||||
def managed_resource():
|
||||
@@ -224,3 +225,12 @@ def managed_resource():
|
||||
def test_context_manager():
|
||||
with managed_resource() as x: # $ MISSING: tracked
|
||||
print(x) # $ MISSING: tracked
|
||||
|
||||
@contextlib.contextmanager
|
||||
def managed_resource2():
|
||||
x = tracked # $ tracked
|
||||
yield x # $ tracked
|
||||
|
||||
def test_context_manager2():
|
||||
with managed_resource2() as x: # $ MISSING: tracked
|
||||
print(x) # $ MISSING: tracked
|
||||
|
||||
Reference in New Issue
Block a user