In January 2021 we will introduce a 10 GB quota for project repositories. Higher limits for individual projects will be available on request. Please see https://doku.lrz.de/display/PUBLIC/GitLab for more information.

Commit 0b21f870 authored by eckhart's avatar eckhart

- syntaxtree.Node.select: Bugfix!!!

parent b2bc5810
......@@ -616,10 +616,9 @@ class Node(collections.abc.Sized):
"""
if include_root and match_function(self):
yield self
else:
for child in self.children:
for node in child.select(match_function, True):
yield node
for child in self.children:
for node in child.select(match_function, True):
yield node
def select_by_tag(self, tag_names: Union[str, AbstractSet[str]],
......
......@@ -75,6 +75,11 @@ class TestNode:
assert str(self.unique_tree) == "ceh"
assert str(self.recurr_tree) == "xey"
def test_select_subnodes(self):
tags = [node.tag_name
for node in self.unique_tree.select(lambda nd: True, include_root=True)]
assert ''.join(tags) == "abdfg", ''.join(tags)
def test_find(self):
found = list(self.unique_tree.select(lambda nd: not nd.children and nd.result == "e"))
assert len(found) == 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment