Skip to content

Commit d71b4e6

Browse files
authored
Merge pull request #99 from VEZY/fix-issue-with-descendants-of-single-symbol
Fix issue with `descendants(mtg, symbol=:Leaf)`
2 parents 46b4a44 + 8758139 commit d71b4e6

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

src/compute_MTG/check_filters.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ end
3131
end
3232

3333
@inline normalize_symbol_allowed(filters::Nothing) = nothing
34+
@inline normalize_symbol_allowed(filter) = (normalize_symbol_filter(filter),)
3435
@inline function normalize_symbol_allowed(filters::T) where {T<:Union{Tuple,AbstractArray}}
3536
map(normalize_symbol_filter, filters)
3637
end

test/test-descendants.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@
5858
@test descendants(mtg) == traverse(mtg[1], x -> x)
5959
@test descendants(mtg, self=true) == traverse(mtg, x -> x)
6060
@test descendants(get_node(mtg, 6), self=true) == [get_node(mtg, 6), get_node(mtg, 7)]
61+
mtg[:symbols] = SubString("Leaf", 1, 4)
62+
@test descendants(mtg, symbol=:Leaf) == [get_node(mtg, 5), get_node(mtg, 7)]
6163

6264
out_nodes = typeof(mtg)[]
6365
@test descendants!(out_nodes, mtg) == traverse(mtg[1], x -> x)

0 commit comments

Comments
 (0)