diff --git a/tools/schemacode/bidsschematools/tests/test_expressions.py b/tools/schemacode/bidsschematools/tests/test_expressions.py index a6f2800626..e2e0704b37 100644 --- a/tools/schemacode/bidsschematools/tests/test_expressions.py +++ b/tools/schemacode/bidsschematools/tests/test_expressions.py @@ -5,7 +5,16 @@ import pytest from pyparsing.exceptions import ParseException -from ..expressions import Array, ASTNode, BinOp, Function, Property, RightOp, expression +from ..expressions import ( + Array, + ASTNode, + BinOp, + Element, + Function, + Property, + RightOp, + expression, +) from ..types import Namespace @@ -148,6 +157,13 @@ def find_names(node: Union[ASTNode, str]): elif isinstance(node, Array): for element in node.elements: yield from find_names(element) + elif isinstance(node, Element): + yield from find_names(node.name) + yield from find_names(node.index) + elif isinstance(node, (int, float)): + return + else: + raise TypeError(f"Unexpected node type: {node!r}") @find_names.register