def test_sequence_init_append(self): seq = models.Sequence('/path/to/file.0100.ext') self.assertListEqual(list(seq._frames), [100]) self.assertEqual(seq.seq_name, '/path/to/file.#.ext') self.assertEqual(seq.namehead, 'file.') self.assertEqual(seq.head, '/path/to/file.') self.assertEqual(seq.path, '/path/to') self.assertEqual(seq.tail, '.ext') self.assertEqual(seq.ext, 'ext') self.assertEqual(seq.padding, 4) self.assertEqual(seq.inconsistent_padding, False)
def test_get_missing_frames(self): files = [ '/abs/path/to/file_0100_name.ext', '/abs/path/to/file_0101_name.ext', '/abs/path/to/file_0103_name.ext', '/abs/path/to/file_0105_name.ext', '/abs/path/to/file_0106_name.ext', '/abs/path/to/file_0107_name.ext', ] seq = models.Sequence() for _file in files: seq.append(_file) self.assertListEqual(seq.get_missing_frames(), [102, 104])
def setUp(self): CONFIG.reset_defaults() files = [ '/abs/path/to/file_0100_name.ext', '/abs/path/to/file_0101_name.ext', '/abs/path/to/file_0102_name.ext', '/abs/path/to/file_0104_name.ext', '/abs/path/to/file_0107_name.ext', '/abs/path/to/file_0108_name.ext', '/abs/path/to/file_0110_name.ext', ] self.seq = models.Sequence() for f in files: self.seq.append(f)
def setUp(self): CONFIG.reset_defaults() missing_files = [ '/abs/path/to/file_0100_name.ext', '/abs/path/to/file_0101_name.ext', '/abs/path/to/file_0102_name.ext', '/abs/path/to/file_0104_name.ext', '/abs/path/to/file_0107_name.ext', '/abs/path/to/file_0108_name.ext', '/abs/path/to/file_01010_name.ext', ] self.missing = models.Sequence() for m in missing_files: self.missing.append(m) contiguous_files = [ '/abs/path/to/file_0100_name.ext', '/abs/path/to/file_0101_name.ext', '/abs/path/to/file_0102_name.ext', '/abs/path/to/file_0103_name.ext', ] self.contiguous = models.Sequence() for m in contiguous_files: self.contiguous.append(m)
def test_sequence_size(self): files = [ ('file.0.ext', { 'size': 10 }), ('file.1.ext', { 'size': 10 }), ('file.2.ext', { 'size': 10 }), ] sequence = models.Sequence() for _file in files: _file = models.File(*_file) sequence.append(_file) self.assertEqual(sequence.size, 30)
def test_sequence_force_consistent_padding(self): _file = models.File('/path/to/file.0100.ext') seq = models.Sequence(_file, ignore_padding=False) self.assertEqual(seq.seq_name, '/path/to/file.%04d.ext') with self.assertRaises(ValueError): seq.append('/path/to/file.00100.ext')
def test_sequence_inconsistent_padding_dupe(self): _file = models.File('/path/to/file.0100.ext') seq = models.Sequence(_file) self.assertEqual(seq.seq_name, '/path/to/file.#.ext') with self.assertRaises(IndexError): seq.append('/path/to/file.00100.ext')
def test_sequence_append_non_member(self): _file = models.File('/path/to/file.0100.ext') seq = models.Sequence(_file) with self.assertRaises(ValueError): seq.append('/not/a/member.0001.ext')
def test_sequence_append_exact_dupe(self): _file = models.File('/path/to/file.0100.ext') seq = models.Sequence(_file) with self.assertRaises(IndexError): seq.append('/path/to/file.0100.ext')
def test_sequence_append_string(self): _file = '/path/to/file.0100.ext' seq = models.Sequence(_file) seq.append('/path/to/file.0101.ext') self.assertEqual(seq.frames, 2)
def test_sequence_append_file(self): file1 = models.File('/path/to/file.0100.ext') seq = models.Sequence(file1) seq.append(models.File('/path/to/file.0101.ext')) self.assertEqual(seq.frames, 2)