Example #1
0
    def test_set_enormous_amount_of_files_auto_fix_multi_indexes(self):
        """The FileSet should raise an error if requested to fix multi-assigned indexes in a set of more than 1000 files."""
        test_set = FileSet(self.pattern, [])
        test_set.files = EnormousDict()
        test_set.max_index = 1234

        mock_find_flaws.side_effect = FileSet.TooManyFilesError()

        with self.assertRaises(
                FileSet.TooManyFilesError,
                msg=
                "The FileSet fails to recognize when there are too many files to auto-fix multi-assigned indexes."
        ):
            test_set.fix(True)
Example #2
0
    def test_set_enormous_amount_of_files_no_multi_index_auto_fix(self):
        """Even if the file set contains more than 1000 files, the file set should fix possible gaps."""
        test_set = FileSet(self.pattern, [])
        test_set.files = EnormousDict()
        test_set.max_index = 1234

        mock_find_flaws.side_effect = FileSet.TooManyFilesError()

        try:
            test_set.fix()
        except FileSet.TooManyFilesError:
            self.fail(
                "The FileSet raises an exception when there's more than 1000 files, even though auto-fix multi-assigned indexes was not requested and thus there should be no problem."
            )