Skip to content

Commit

Permalink
add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
clavedeluna committed Oct 17, 2023
1 parent 969d6bb commit 800fb77
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions tests/codemods/test_with_threading_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@ class TestThreadingNameResolution(BaseSemgrepCodemodTest):
lock = 1
def f(l):
with threading.Lock():
return [lock_ for lock_ in l]
return [lock_1 for lock_1 in l]
""",
"""import threading
lock = 1
def f(l):
lock_1 = threading.Lock()
with lock_1:
return [lock_ for lock_ in l]
lock_2 = threading.Lock()
with lock_2:
return [lock_1 for lock_1 in l]
""",
),
(
Expand Down Expand Up @@ -170,6 +170,21 @@ def f(l):
lock = threading.Lock()
with lock:
print()
""",
),
(
"""import threading
def my_func():
lock = "whatever"
with threading.Lock():
foo()
""",
"""import threading
def my_func():
lock = "whatever"
lock_1 = threading.Lock()
with lock_1:
foo()
""",
),
],
Expand Down

0 comments on commit 800fb77

Please sign in to comment.