MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_walk_topdown

Method test_walk_topdown

Lib/test/test_os.py:1549–1564  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1547 del self.sub2_tree[1][:1]
1548
1549 def test_walk_topdown(self):
1550 # Walk top-down.
1551 all = list(self.walk(self.walk_path))
1552
1553 self.assertEqual(len(all), 4)
1554 # We can't know which order SUB1 and SUB2 will appear in.
1555 # Not flipped: TESTFN, SUB1, SUB11, SUB2
1556 # flipped: TESTFN, SUB2, SUB1, SUB11
1557 flipped = all[0][1][0] != "SUB1"
1558 all[0][1].sort()
1559 all[3 - 2 * flipped][-1].sort()
1560 all[3 - 2 * flipped][1].sort()
1561 self.assertEqual(all[0], (self.walk_path, ["SUB1", "SUB2"], ["tmp1"]))
1562 self.assertEqual(all[1 + flipped], (self.sub1_path, ["SUB11"], ["tmp2"]))
1563 self.assertEqual(all[2 + flipped], (self.sub11_path, [], []))
1564 self.assertEqual(all[3 - 2 * flipped], self.sub2_tree)
1565
1566 def test_walk_prune(self, walk_path=None):
1567 if walk_path is None:

Callers

nothing calls this directly

Calls 5

walkMethod · 0.95
listClass · 0.85
lenFunction · 0.85
assertEqualMethod · 0.45
sortMethod · 0.45

Tested by

no test coverage detected