diff options
author | Julien Valroff <julien@kirya.net> | 2010-06-01 20:31:42 +0200 |
---|---|---|
committer | Julien Valroff <julien@kirya.net> | 2010-06-01 20:31:42 +0200 |
commit | 15c0dded257070147401c9c308fdbdff9387d00c (patch) | |
tree | 21b6fe91d901dc69cb4ed53e4cba1caa8077c988 /rapid/renamesubfolderprefstest.py | |
parent | e6887e38b8c89124f38a45fd727ab6dfc4f3a8c8 (diff) | |
parent | f49f82b74596eda33ee5e2fc14e51fd67351b9ec (diff) |
Merge commit 'upstream/0.2.0'
Diffstat (limited to 'rapid/renamesubfolderprefstest.py')
-rw-r--r-- | rapid/renamesubfolderprefstest.py | 63 |
1 files changed, 60 insertions, 3 deletions
diff --git a/rapid/renamesubfolderprefstest.py b/rapid/renamesubfolderprefstest.py index a689c5c..26afd97 100644 --- a/rapid/renamesubfolderprefstest.py +++ b/rapid/renamesubfolderprefstest.py @@ -35,6 +35,31 @@ class PreferenceTest (unittest.TestCase): [FILENAME, EXTENSION, LOWERCASE] ) + video_name_test= ( + [DATE_TIME, VIDEO_DATE, 'HHMMSS'], + [METADATA, CODEC, LOWERCASE], + [METADATA, FPS, ''], + ) + + video_name_test2= ( + [DATE_TIME, VIDEO_DATE, 'HHMMSS', + METADATA, CODEC, LOWERCASE, + METADATA, FPS, ''], + ) + + video_name_test3= ( + [FILENAME, VIDEO_NUMBER, IMAGE_NUMBER_4, + FILENAME, NAME_EXTENSION, LOWERCASE, + METADATA, FPS, ''], + ) + + video_subfolder_test= ( + [DATE_TIME, TODAY, 'HHMMSS', + SEPARATOR, '', '', + METADATA, WIDTH, ''], + ) + + trueMetadataTest = ([FILENAME, EXTENSION, LOWERCASE, TEXT, '', '', METADATA, APERTURE, ''], [METADATA, APERTURE, '', TEXT, '', '', FILENAME, EXTENSION, LOWERCASE], ) falseMetadataTest = ([FILENAME, EXTENSION, LOWERCASE, METADATA, APERTURE, '', FILENAME, NAME, LOWERCASE], @@ -52,6 +77,17 @@ class PreferenceTest (unittest.TestCase): for pref in self.image_test: result = checkPreferenceValid(DICT_IMAGE_RENAME_L0, pref) self.assertEqual(result, True) + + def testPrefVideoList(self): + for pref in self.video_name_test: + result = checkPreferenceValid(DICT_VIDEO_RENAME_L0, pref) + self.assertEqual(result, True) + for pref in self.video_name_test2: + result = checkPreferenceValid(DICT_VIDEO_RENAME_L0, pref) + self.assertEqual(result, True) + for pref in self.video_name_test3: + result = checkPreferenceValid(DICT_VIDEO_RENAME_L0, pref) + self.assertEqual(result, True) def testSequencesList(self): for pref in self.sequences_test: @@ -68,8 +104,6 @@ class PreferenceTest (unittest.TestCase): p = ImageRenamePreferences(i, None) result = p.needImageMetaDataToCreateUniqueName() self.assertEqual(result, False) - - def testLargePrefList(self): prefList = [] @@ -84,6 +118,11 @@ class PreferenceTest (unittest.TestCase): for pref in self.subfolder_test: result = checkPreferenceValid(DICT_SUBFOLDER_L0, pref) self.assertEqual(result, True) + + def testPrefVideoSubfolderList(self): + for pref in self.video_subfolder_test: + result = checkPreferenceValid(DICT_VIDEO_SUBFOLDER_L0, pref) + self.assertEqual(result, True) def testDateTimeL2Length(self): self.assertEqual(len(LIST_DATE_TIME_L2), len(DATE_TIME_CONVERT)) @@ -107,6 +146,12 @@ class BadPreferences(unittest.TestCase): [DATE_TIME, None, None], [DATE_TIME, '', ''], ) + + bad_image_key2 = ( + [FILENAME, VIDEO_NUMBER, IMAGE_NUMBER_4, + FILENAME, NAME_EXTENSION, LOWERCASE, + METADATA, APERTURE, ''], + ) bad_subfolder_key = ([FILENAME, NAME_EXTENSION, UPPERCASE],) @@ -145,12 +190,18 @@ class BadPreferences(unittest.TestCase): self.assertRaises(PrefKeyError, checkPreferenceValid, DICT_IMAGE_RENAME_L0, pref) + for pref in self.bad_image_key2: + self.assertRaises(PrefKeyError, checkPreferenceValid, + DICT_IMAGE_RENAME_L0, + pref) + def testBadImageValue(self): for pref in self.bad_image_value: self.assertRaises(PrefValueInvalidError, checkPreferenceValid, DICT_IMAGE_RENAME_L0, - pref) + pref) + def testBadSubfolderKey(self): for pref in self.bad_subfolder_key: @@ -186,5 +237,11 @@ class BadPreferences(unittest.TestCase): s = SubfolderPreferences(pref, self) self.assertRaises(PrefValueKeyComboError, s.checkPrefsForValidity) + def testBadVideoSubfolderCombo(self): + + for pref in self.bad_subfolder_combos: + s = VideoSubfolderPreferences(pref, self) + self.assertRaises(PrefValueKeyComboError, s.checkPrefsForValidity) + if __name__ == "__main__": unittest.main() |