def test_corrupted_file_handling_unpickling_error(self, mock_os_remove, mock_create_model_and_transforms):
        """Ensure that a proper error is raised when a corrupted file is encountered. The file should be removed."""
        mock_create_model_and_transforms.side_effect = UnpicklingError("The file might be corrupted")
        for model_properties in self.dummy_model_properties:
            with patch("marqo.inference.native_inference.embedding_models.open_clip_model.download_model",
                       return_value=self.dummy_corrupted_file):
                with self.assertRaises(InvalidModelPropertiesError) as context:
                    _ = _load_model(**self.load_parameters, model_properties=model_properties, max_retries=1)
                # Verify
                self.assertIn("Marqo encountered a corrupted file when loading open_clip file", str(context.exception))
                mock_os_remove.assert_called_once_with(self.dummy_corrupted_file)

                # Reset the mock
                mock_os_remove.reset_mock()
Ensure that a proper error is raised when a corrupted file is encountered. The file should be removed.
tests/unit_tests/marqo/inference/native_inference/test_handling_corrupt_files_open_clip.py