Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def testSerialization(self):
fs = FileSequence("/path/to/file.1-100x2#.exr")
s = pickle.dumps(fs, pickle.HIGHEST_PROTOCOL)
fs2 = pickle.loads(s)
self.assertEquals(str(fs), str(fs2))
self.assertEquals(len(fs), len(fs2))
fs = FileSequence("/path/to/file.1-100x2%04d.exr")
s = pickle.dumps(fs, pickle.HIGHEST_PROTOCOL)
fs2 = pickle.loads(s)
self.assertEquals(str(fs), str(fs2))
self.assertEquals(len(fs), len(fs2))
def testSeqGettersPrintf(self):
seq = FileSequence("/foo/boo.1-5%04d.exr")
self.assertEquals(5, len(seq))
self.assertEquals("/foo/", seq.dirname())
self.assertEquals("boo.", seq.basename())
self.assertEquals("%04d", seq.padding())
self.assertEquals(".exr", seq.extension())
self.assertEquals("/foo/boo.9999.exr", seq.frame(9999))
self.assertEquals("/foo/boo.0001.exr", seq[0])
self.assertEquals("/foo/boo.0001.exr", seq.index(0))
def testSplitXY(self):
seqs = FileSequence("/cheech/0-9x1/chong.1-10#.exr")
self.assertEquals("/cheech/0-9x1/chong.0001.exr", seqs.index(0))
def testSeqGettersHoudini(self):
seq = FileSequence("/foo/boo.1-5$F.exr")
self.assertEquals(5, len(seq))
self.assertEquals("/foo/", seq.dirname())
self.assertEquals("boo.", seq.basename())
self.assertEquals("$F", seq.padding())
self.assertEquals(".exr", seq.extension())
self.assertEquals("/foo/boo.9999.exr", seq.frame(9999))
self.assertEquals("/foo/boo.1.exr", seq[0])
self.assertEquals("/foo/boo.1.exr", seq.index(0))
def testFrame(self):
seq = FileSequence("/foo/bar/bing.#.exr")
self.assertEquals("/foo/bar/bing.0001.exr", seq.frame(1))
self.assertNativeStr(seq.frame(1))
self.assertEquals("/foo/bar/bing.#.exr", seq.frame("#"))
self.assertNativeStr(seq.frame("#"))
seq = FileSequence("/foo/bar/bing.%04d.exr")
self.assertEquals("/foo/bar/bing.0001.exr", seq.frame(1))
self.assertEquals("/foo/bar/bing.%04d.exr", seq.frame("%04d"))
def testSetFrameSet(self):
seq = FileSequence("/cheech/chong.1-5#.exr")
seq.setFrameSet(FrameSet("10-20"))
self.assertEquals("/cheech/chong.10-20#.exr", str(seq))
def testNativeStr(self):
seq = FileSequence("/foo/boo.1-5#.exr")
self.assertNativeStr(seq.dirname())
self.assertNativeStr(seq.basename())
self.assertNativeStr(seq.padding())
self.assertNativeStr(seq.extension())
self.assertNativeStr(seq.extension())
self.assertNativeStr(seq.format('{basename}'))
self.assertNativeStr(seq.frame(1))
self.assertNativeStr(seq.frameRange())
self.assertNativeStr(seq.index(1))
self.assertNativeStr(seq.invertedFrameRange())
self.assertNativeStr(FileSequence.conformPadding('#'))
self.assertNativeStr(FileSequence.getPaddingChars(4))
def testEmptyBasename(self):
seq = FileSequence("/path/to/1-5#.exr")
self.assertEquals(seq.basename(), "")
self.assertEquals(len(seq), 5)
self.assertEquals(seq.padding(), '#')
seq = FileSequence("/path/to/1-5%04d.exr")
self.assertEquals(seq.basename(), "")
self.assertEquals(len(seq), 5)
self.assertEquals(seq.padding(), '%04d')
seq = FileSequence("/path/to/1-5$F4.exr")
self.assertEquals(seq.basename(), "")
self.assertEquals(len(seq), 5)
self.assertEquals(seq.padding(), "$F4")
def testSetBasename(self):
seq = FileSequence("/foo/bong.1-5@.exr")
seq.setBasename("bar.")
self.assertEquals("/foo/bar.1.exr", seq[0])