Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
DHParser
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
badw-it
DHParser
Commits
0b21f870
Commit
0b21f870
authored
May 13, 2018
by
eckhart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- syntaxtree.Node.select: Bugfix!!!
parent
b2bc5810
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
DHParser/syntaxtree.py
DHParser/syntaxtree.py
+3
-4
test/test_syntaxtree.py
test/test_syntaxtree.py
+5
-0
No files found.
DHParser/syntaxtree.py
View file @
0b21f870
...
...
@@ -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
]],
...
...
test/test_syntaxtree.py
View file @
0b21f870
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment