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

Function test_entrypoint_variable

tests/test_treesitter_sanitizer.py:211–258  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

209
210
211def test_entrypoint_variable():
212 icode = r"""Following is the code snippet:
213```python
214import numpy as np
215from numpy import sin, cos
216
217SOME_CONSTANT = 5
218
219def f(x):
220 return c(x)
221assert f(1) == 5
222def g(x):
223 return cos(f(x))
224
225def c(x):
226 newObj = h()
227 return x
228
229class h():
230 def hello_world():
231 return SOME_CONSTANT
232
233def d(x):
234 return g(x)
235
236# Some tests
237assert g(0) == 1
238print(g(123))
239ret = g(321)
240```
241"""
242
243 assert (
244 sanitize(icode, "g")
245 == r"""import numpy as np
246from numpy import sin, cos
247SOME_CONSTANT = 5
248def f(x):
249 return c(x)
250def g(x):
251 return cos(f(x))
252def c(x):
253 newObj = h()
254 return x
255class h():
256 def hello_world():
257 return SOME_CONSTANT"""
258 )

Callers

nothing calls this directly

Calls 1

sanitizeFunction · 0.90

Tested by

no test coverage detected