Realized it would be convenient for coverage work to let us look up defining method AST nodes via found statement nodes.
How I did it
The functions at module level AST are found via [n for n in self.children if n.ast_type == "FunctionDef"]
And if any function node contains the given line numbers, than it must be the defining function node.
Else it may not be in a function, and that is fine also.
How to verify it
Checklist
[ ] Passes all linting checks (pre-commit and CI jobs)
[ ] New test cases have been added and are passing
[ ] Documentation has been updated
[ ] PR title follows Conventional Commit standard (will be automatically included in the changelog)
What I did
Realized it would be convenient for coverage work to let us look up defining method AST nodes via found statement nodes.
How I did it
The functions at module level AST are found via
[n for n in self.children if n.ast_type == "FunctionDef"]
And if any function node contains the given line numbers, than it must be the defining function node. Else it may not be in a function, and that is fine also.How to verify it
Checklist