fix: update nested functions parity test to match new JS discovery behavior

PR #1968 changed JS to skip nested functions like Python, but the parity
test still expected JS to discover both outer and inner.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
ali 2026-04-02 21:02:23 +02:00
parent f86fe2d4ed
commit 834adc5a43
No known key found for this signature in database
GPG key ID: 44F9B42770617B9B

View file

@ -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."""