Skip to content

Commit 618a791

Browse files
committed
Simplify test
1 parent 6229ad5 commit 618a791

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

Doc/library/functools.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ The :mod:`functools` module defines the following functions:
679679
yield from node_group
680680
self.done(*node_group)
681681

682-
The particular order that is returned may depend on the particular order in
682+
The particular order that is returned may depend on the specific order in
683683
which the items were inserted in the graph. For example:
684684

685685
.. doctest::

Lib/functools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ def _find_cycle(self):
415415
def static_order(self):
416416
"""Returns an iterable of nodes in a topological order.
417417
418-
The particular order that is returned may depend on the particular
418+
The particular order that is returned may depend on the specific
419419
order in which the items were inserted in the graph.
420420
421421
Using this method does not require to call "prepare" or "done". If any

Lib/test/test_functools.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,9 +1384,8 @@ def get_groups(ts):
13841384
ts.prepare()
13851385
while ts.is_active():
13861386
nodes = ts.get_ready()
1387-
for node in nodes:
1388-
ts.done(node)
1389-
yield nodes
1387+
ts.done(*nodes)
1388+
yield set(nodes)
13901389

13911390
ts = functools.TopologicalSorter()
13921391
ts.add(3, 2, 1)
@@ -1402,10 +1401,7 @@ def get_groups(ts):
14021401
ts2.add(6, 7)
14031402
ts2.add(4, 5)
14041403

1405-
self.assertEqual(
1406-
list(map(set, get_groups(ts))),
1407-
list(map(set, get_groups(ts2)))
1408-
)
1404+
self.assertEqual(list(get_groups(ts)), list(get_groups(ts2)))
14091405

14101406
def test_static_order_does_not_change_with_the_hash_seed(self):
14111407
def check_order_with_hash_seed(seed):

0 commit comments

Comments
 (0)