MCPcopy Index your code
hub / github.com/evalplus/evalplus / test_inline_fn

Function test_inline_fn

tests/test_legacy_sanitizer.py:6–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4
5
6def test_inline_fn():
7 assert (
8 sanitize(
9 """\
10def f(n):
11 def factorial(i):
12 if i == 0:
13 return 1
14 else:
15 return i * factorial(i-1)
16
17 result = []
18 for i in range(1, n+1):
19 if i % 2 == 0:
20 result.append(factorial(i))
21 else:
22 result.append(sum(range(1, i+1)))
23 return result
24
25# Test the function
26print(f(5))""",
27 entry_point="f",
28 )
29 == """\
30def f(n):
31 def factorial(i):
32 if i == 0:
33 return 1
34 else:
35 return i * factorial(i-1)
36
37 result = []
38 for i in range(1, n+1):
39 if i % 2 == 0:
40 result.append(factorial(i))
41 else:
42 result.append(sum(range(1, i+1)))
43 return result"""
44 )

Callers

nothing calls this directly

Calls 1

sanitizeFunction · 0.90

Tested by

no test coverage detected