MCPcopy Index your code
hub / github.com/bpython/bpython / get_fodder_source

Function get_fodder_source

bpython/test/test_preprocess.py:18–33  ·  view source on GitHub ↗
(test_name)

Source from the content-addressed store, hash-verified

16
17
18def get_fodder_source(test_name):
19 pattern = rf"#StartTest-{test_name}\n(.*?)#EndTest"
20 orig, xformed = (
21 re.search(pattern, inspect.getsource(module), re.DOTALL)
22 for module in [original, processed]
23 )
24
25 if not orig:
26 raise ValueError(
27 f"Can't locate test {test_name} in original fodder file"
28 )
29 if not xformed:
30 raise ValueError(
31 f"Can't locate test {test_name} in processed fodder file"
32 )
33 return orig.group(1), xformed.group(1)
34
35
36class TestPreprocessing(unittest.TestCase):

Callers 1

assertLinesIndentedMethod · 0.85

Calls 1

searchMethod · 0.80

Tested by

no test coverage detected