Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 883bd9f commit 2399793Copy full SHA for 2399793
1 file changed
python/ql/test/experimental/dataflow/typetracking/test.py
@@ -215,6 +215,7 @@ def test_yield():
215
216
# see https://docs.python.org/3.11/library/contextlib.html#contextlib.contextmanager
217
from contextlib import contextmanager
218
+import contextlib
219
220
@contextmanager
221
def managed_resource():
@@ -224,3 +225,12 @@ def managed_resource():
224
225
def test_context_manager():
226
with managed_resource() as x: # $ MISSING: tracked
227
print(x) # $ MISSING: tracked
228
+
229
+@contextlib.contextmanager
230
+def managed_resource2():
231
+ x = tracked # $ tracked
232
+ yield x # $ tracked
233
234
+def test_context_manager2():
235
+ with managed_resource2() as x: # $ MISSING: tracked
236
+ print(x) # $ MISSING: tracked
0 commit comments