Closed
Description
test_walk_topdown()
attempts to handle all possible visitation orders, but the result is difficult to read. We can enforce a specific order by sorting dirnames
.
cpython/Lib/test/test_pathlib.py
Lines 2680 to 2694 in a6f9594
test_walk_bottom_up()
suffers similar problems, and also makes unjustified assertions about the order that siblings are visited (which is arbitrary and cannot be influenced by the user, contrary to top-down mode). It can be simplified to ensure that children are yielded before parents.
cpython/Lib/test/test_pathlib.py
Lines 2717 to 2735 in a6f9594