(self, walk_path=None)
| 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)) |
no test coverage detected