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

Method test_walk_prune

Lib/test/test_os.py:1566–1583  ·  view source on GitHub ↗
(self, walk_path=None)

Source from the content-addressed store, hash-verified

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:
1568 walk_path = self.walk_path
1569 # Prune the search.
1570 all = []
1571 for root, dirs, files in self.walk(walk_path):
1572 all.append((root, dirs, files))
1573 # Don't descend into SUB1.
1574 if 'SUB1' in dirs:
1575 # Note that this also mutates the dirs we appended to all!
1576 dirs.remove('SUB1')
1577
1578 self.assertEqual(len(all), 2)
1579 self.assertEqual(all[0], (self.walk_path, ["SUB2"], ["tmp1"]))
1580
1581 all[1][-1].sort()
1582 all[1][1].sort()
1583 self.assertEqual(all[1], self.sub2_tree)
1584
1585 def test_file_like_path(self):
1586 self.test_walk_prune(FakePath(self.walk_path))

Callers 1

test_file_like_pathMethod · 0.95

Calls 6

walkMethod · 0.95
lenFunction · 0.85
appendMethod · 0.45
removeMethod · 0.45
assertEqualMethod · 0.45
sortMethod · 0.45

Tested by

no test coverage detected