def test_remove_when_all_files_missing(self): d = PathList() files = ["/tmp/missing.txt", "/tmp/missing2.txt", "/tmp/missing3.txt"] d.add(*files) self.assertEqual(len(d), 3) d.remove_missing() self.assertFalse(d)
def test_remove_one_missing_file(self): d = PathList() files = ["/tmp/missing.txt", "/tmp/foo.txt", "/tmp/bar.txt"] d.add(*files) self.assertEqual(len(d), 3) d.remove_missing() self.assertEqual(len(d), 2)
def test_dont_remove_globbable_files(self): d = PathList() files = [ "/tmp/foo", "/tmp/missing*", "/tmp/missing.[0-9]", "/tmp/missing.????.exr" ] d.add(*files) self.assertEqual(len(d), 4) d.remove_missing() self.assertEqual(len(d), 4)
def test_remove_missing_when_dups_given(self): d = PathList() files = [ "/tmp/missing", "/tmp/foo", "/tmp/bar", "/tmp/foo", "/tmp/missing2", "/tmp/missing" ] d.add(*files) self.assertEqual(len(d), 4) d.remove_missing() self.assertEqual(len(d), 2)