Skip to content

python_reader: correctly handle decorators and nested functions #2277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

thseiler
Copy link
Contributor

This PR is an attempt to fix issues #2275 and #2276.

reader_python.py's get_node_ns() is changed to walk up the tree and collect all identifiers along the way.

This should generate function names that are reasonnably unique and should work well as UIDs for the test report generation, for example:
ClassName.NestedClassName.method_name.nested_methodname

I am a bit concerned as this change invalidates unit test_02_functions(), which was specifically checking that nested functions are exported as flat functions (i.e. without their parent names). Therefore, I am unsure if my attempt at fixing this breaks something else...

@stanislaw stanislaw merged commit 2903beb into strictdoc-project:main May 27, 2025
14 checks passed
@stanislaw
Copy link
Collaborator

I am a bit concerned as this change invalidates unit test_02_functions(), which was specifically checking that nested functions are exported as flat functions (i.e. without their parent names). Therefore, I am unsure if my attempt at fixing this breaks something else...

Doing nested functions as dot-separated makes sense as part of the general approach 👍

@thseiler thseiler deleted the bugfix/reader-python-fix-decorated-methods branch May 27, 2025 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants