mirror of
https://github.com/codeflash-ai/codeflash.git
synced 2026-05-04 18:25:17 +00:00
Merge pull request #1976 from codeflash-ai/fix/nested-functions-parity-test
fix: update nested functions parity test
This commit is contained in:
commit
b0c4e1f10e
1 changed files with 4 additions and 10 deletions
|
|
@ -440,25 +440,19 @@ class TestDiscoverFunctionsParity:
|
|||
assert js_sync.is_async is False, "JavaScript sync function should have is_async=False"
|
||||
|
||||
def test_nested_functions_discovery(self, python_support, js_support):
|
||||
"""Python skips nested functions; JavaScript discovers them with parent info."""
|
||||
"""Both Python and JavaScript skip nested functions — only outer is discovered."""
|
||||
py_file = write_temp_file(NESTED_FUNCTIONS.python, ".py")
|
||||
js_file = write_temp_file(NESTED_FUNCTIONS.javascript, ".js")
|
||||
|
||||
py_funcs = python_support.discover_functions(py_file.read_text(encoding="utf-8"), py_file)
|
||||
js_funcs = js_support.discover_functions(js_file.read_text(encoding="utf-8"), js_file)
|
||||
|
||||
# Python skips nested functions — only outer is discovered
|
||||
# Both skip nested functions — only outer is discovered
|
||||
assert len(py_funcs) == 1, f"Python found {len(py_funcs)}, expected 1"
|
||||
assert py_funcs[0].function_name == "outer"
|
||||
|
||||
# JavaScript discovers both
|
||||
assert len(js_funcs) == 2, f"JavaScript found {len(js_funcs)}, expected 2"
|
||||
js_names = {f.function_name for f in js_funcs}
|
||||
assert js_names == {"outer", "inner"}, f"JavaScript found {js_names}"
|
||||
|
||||
js_inner = next(f for f in js_funcs if f.function_name == "inner")
|
||||
assert len(js_inner.parents) >= 1, "JavaScript inner should have parent info"
|
||||
assert js_inner.parents[0].name == "outer", "JavaScript inner's parent should be outer"
|
||||
assert len(js_funcs) == 1, f"JavaScript found {len(js_funcs)}, expected 1"
|
||||
assert js_funcs[0].function_name == "outer"
|
||||
|
||||
def test_static_methods_discovery(self, python_support, js_support):
|
||||
"""Both should discover static methods."""
|
||||
|
|
|
|||
Loading…
Reference in a new issue