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

Function test_code_extract

tests/test_treesitter_sanitizer.py:4–36  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2
3
4def test_code_extract():
5 test_simple = r"""Here is some python code generated
6import numpy as np
7Sorry, I made a mistake, let me try again
8from numpy import sin, cos, tan
9
10def f(x):
11 return tan(x)
12As you can observe from above
13 """
14 assert (
15 code_extract(test_simple)
16 == r"""from numpy import sin, cos, tan
17
18def f(x):
19 return tan(x)"""
20 )
21
22 test_empty_lines = r"""import numpy as np
23
24
25import pandas
26Sorry, let me try again
27from numpy import sin, cos, tan
28def f(x):
29 return tan(x)
30"""
31 assert (
32 code_extract(test_empty_lines)
33 == r"""from numpy import sin, cos, tan
34def f(x):
35 return tan(x)"""
36 )
37
38
39def test_sanitize_simple():

Callers

nothing calls this directly

Calls 1

code_extractFunction · 0.90

Tested by

no test coverage detected