def testEnabled(self): p = Gaffer.FileSystemPath(self.__dir, includeSequences=True) self.assertTrue(p.getIncludeSequences()) p.setFilter( Gaffer.FileSequencePathFilter( mode=Gaffer.FileSequencePathFilter.Keep.Files)) self.assertEqual(p.getFilter().getMode(), Gaffer.FileSequencePathFilter.Keep.Files) self.assertEqual( set([str(c) for c in p.children()]), set([ self.__dir + "/singleFile.txt", self.__dir + "/dir", ])) p.getFilter().setEnabled(False) self.assertEqual( set([str(c) for c in p.children()]), set([ self.__dir + "/singleFile.txt", self.__dir + "/a.001.txt", self.__dir + "/a.002.txt", self.__dir + "/a.004.txt", self.__dir + "/b.003.txt", self.__dir + "/dir", self.__dir + "/a.###.txt", self.__dir + "/b.###.txt" ]))
def testNoSequences(self): # it doesn't really make sense to do this, # as we're using a sequence filter on a # path that by definition has no sequences, # but we may as well verify that it works. p = Gaffer.FileSystemPath(self.__dir, includeSequences=False) self.assertFalse(p.getIncludeSequences()) self.assertEqual( set([str(c) for c in p.children()]), set([ self.__dir + "/singleFile.txt", self.__dir + "/a.001.txt", self.__dir + "/a.002.txt", self.__dir + "/a.004.txt", self.__dir + "/b.003.txt", self.__dir + "/dir", ])) p.setFilter( Gaffer.FileSequencePathFilter( mode=Gaffer.FileSequencePathFilter.Keep.Files)) self.assertEqual(p.getFilter().getMode(), Gaffer.FileSequencePathFilter.Keep.Files) self.assertEqual( set([str(c) for c in p.children()]), set([ self.__dir + "/singleFile.txt", self.__dir + "/dir", ])) p.getFilter().setMode( Gaffer.FileSequencePathFilter.Keep.SequentialFiles) self.assertEqual(p.getFilter().getMode(), Gaffer.FileSequencePathFilter.Keep.SequentialFiles) self.assertEqual( set([str(c) for c in p.children()]), set([ self.__dir + "/a.001.txt", self.__dir + "/a.002.txt", self.__dir + "/a.004.txt", self.__dir + "/b.003.txt", self.__dir + "/dir", ])) p.getFilter().setMode(Gaffer.FileSequencePathFilter.Keep.Sequences) self.assertEqual(p.getFilter().getMode(), Gaffer.FileSequencePathFilter.Keep.Sequences) self.assertEqual(set([str(c) for c in p.children()]), set([ self.__dir + "/dir", ])) p.getFilter().setMode(Gaffer.FileSequencePathFilter.Keep.Concise) self.assertEqual(p.getFilter().getMode(), Gaffer.FileSequencePathFilter.Keep.Concise) self.assertEqual( set([str(c) for c in p.children()]), set([ self.__dir + "/singleFile.txt", self.__dir + "/dir", ])) p.getFilter().setMode(Gaffer.FileSequencePathFilter.Keep.Verbose) self.assertEqual(p.getFilter().getMode(), Gaffer.FileSequencePathFilter.Keep.Verbose) self.assertEqual( set([str(c) for c in p.children()]), set([ self.__dir + "/singleFile.txt", self.__dir + "/a.001.txt", self.__dir + "/a.002.txt", self.__dir + "/a.004.txt", self.__dir + "/b.003.txt", self.__dir + "/dir", ])) p.getFilter().setMode(Gaffer.FileSequencePathFilter.Keep.All) self.assertEqual(p.getFilter().getMode(), Gaffer.FileSequencePathFilter.Keep.All) self.assertEqual( set([str(c) for c in p.children()]), set([ self.__dir + "/singleFile.txt", self.__dir + "/a.001.txt", self.__dir + "/a.002.txt", self.__dir + "/a.004.txt", self.__dir + "/b.003.txt", self.__dir + "/dir", ]))