Skip to content

Commit

Permalink
Merge pull request #4404 from yut23/fix_find_lowest_subclasses
Browse files Browse the repository at this point in the history
  • Loading branch information
neutrinoceros authored Apr 8, 2023
2 parents bf56dbc + b5045af commit c29aae4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion yt/utilities/hierarchy_inspection.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ def find_lowest_subclasses(candidates: List[Type]) -> List[Type]:

count = reduce(lambda x, y: x + y, counters)

return [x for x in count.keys() if count[x] == 1]
return [x for x in candidates if count[x] == 1]
6 changes: 6 additions & 0 deletions yt/utilities/tests/test_hierarchy_inspection.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,9 @@ def test_diverging_tree():
result = find_lowest_subclasses([level1, level2, level3, level1a])
assert len(result) == 2
assert level1a in result and level3 in result


def test_without_parents():
result = find_lowest_subclasses([level1, level3])
assert len(result) == 1
assert level3 in result

0 comments on commit c29aae4

Please sign in to comment.