MCPcopy
hub / github.com/evalplus/evalplus / test_entrypoint_chain

Function test_entrypoint_chain

tests/test_treesitter_sanitizer.py:130–173  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

128
129
130def test_entrypoint_chain():
131 icode = r"""Following is the code snippet:
132```python
133import numpy as np
134from numpy import sin, cos
135
136def f(x):
137 return c(x)
138assert f(1) == 5
139def g(x):
140 return cos(f(x))
141
142def c(x):
143 newObj = h()
144 return x
145
146class h():
147 def hello_world():
148 return 0
149
150class h():
151 def goodbye_world():
152 return 0
153
154
155assert g(0) == 1
156```
157"""
158 print(sanitize(icode, "g"))
159 assert (
160 sanitize(icode, "g")
161 == r"""import numpy as np
162from numpy import sin, cos
163def f(x):
164 return c(x)
165def g(x):
166 return cos(f(x))
167def c(x):
168 newObj = h()
169 return x
170class h():
171 def hello_world():
172 return 0"""
173 )
174
175
176def test_entrypoint_no_chain():

Callers

nothing calls this directly

Calls 1

sanitizeFunction · 0.90

Tested by

no test coverage detected