mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
18 lines
394 B
Python
18 lines
394 B
Python
|
|
#Make a list of functions to increment their arguments by 0 to 9.
|
|
def make_incrementers():
|
|
result = []
|
|
for i in range(10):
|
|
def incrementer(x):
|
|
return x + i
|
|
result.append(incrementer)
|
|
return result
|
|
|
|
#This will fail
|
|
def test():
|
|
incs = make_incrementers()
|
|
for x in range(10):
|
|
for y in range(10):
|
|
assert incs[x](y) == x+y
|
|
|
|
test() |