Skip to content

Commit

Permalink
Change Prune function's name
Browse files Browse the repository at this point in the history
to something hopefully a bit clearer
  • Loading branch information
jessebrennan committed Feb 4, 2021
1 parent a819a71 commit 3c0087f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/cutest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,13 @@ def print_graph(self, stream_: ThreadSafeOutputStream, depth=0):
for node in self.children:
node.print_graph(stream_, depth=depth + 1)

def prune_all_but(self, nodes: Iterable['Node']) -> bool:
def prune_children_except(self, nodes: Iterable['Node']) -> bool:
"""
Prune children unless they are in nodes or ancestors of nodes.
Return if this node should be saved
"""
save_children = [c for c in self.children if c.prune_all_but(nodes)]
save_children = [c for c in self.children if c.prune_children_except(nodes)]
self.children = save_children
return self in nodes or any(save_children)

Expand Down Expand Up @@ -375,7 +375,7 @@ def pruned_suites(self, tests: Set[Test]):
assert None not in raw_suites
for suite in raw_suites:
suite.initialize()
if suite.prune_all_but(tests):
if suite.prune_children_except(tests):
yield suite

def run_suite(self, suite: Suite):
Expand Down

0 comments on commit 3c0087f

Please sign in to comment.