diff --git a/mediapipe/tasks/python/test/audio/audio_classifier_test.py b/mediapipe/tasks/python/test/audio/audio_classifier_test.py index 983e922e7..0d067e587 100644 --- a/mediapipe/tasks/python/test/audio/audio_classifier_test.py +++ b/mediapipe/tasks/python/test/audio/audio_classifier_test.py @@ -174,12 +174,10 @@ class AudioClassifierTest(parameterized.TestCase): self.assertIsInstance(classifier, _AudioClassifier) def test_create_from_options_fails_with_invalid_model_path(self): - # Invalid empty model path. with self.assertRaisesRegex( - ValueError, - r"ExternalFile must specify at least one of 'file_content', " - r"'file_name', 'file_pointer_meta' or 'file_descriptor_meta'."): - base_options = _BaseOptions(model_asset_path='') + RuntimeError, 'Unable to open file at /path/to/invalid/model.tflite'): + base_options = _BaseOptions( + model_asset_path='/path/to/invalid/model.tflite') options = _AudioClassifierOptions(base_options=base_options) _AudioClassifier.create_from_options(options) diff --git a/mediapipe/tasks/python/test/text/text_classifier_test.py b/mediapipe/tasks/python/test/text/text_classifier_test.py index c93def48e..434181fbe 100644 --- a/mediapipe/tasks/python/test/text/text_classifier_test.py +++ b/mediapipe/tasks/python/test/text/text_classifier_test.py @@ -154,12 +154,10 @@ class ImageClassifierTest(parameterized.TestCase): self.assertIsInstance(classifier, _TextClassifier) def test_create_from_options_fails_with_invalid_model_path(self): - # Invalid empty model path. with self.assertRaisesRegex( - ValueError, - r"ExternalFile must specify at least one of 'file_content', " - r"'file_name', 'file_pointer_meta' or 'file_descriptor_meta'."): - base_options = _BaseOptions(model_asset_path='') + RuntimeError, 'Unable to open file at /path/to/invalid/model.tflite'): + base_options = _BaseOptions( + model_asset_path='/path/to/invalid/model.tflite') options = _TextClassifierOptions(base_options=base_options) _TextClassifier.create_from_options(options) diff --git a/mediapipe/tasks/python/test/vision/image_classifier_test.py b/mediapipe/tasks/python/test/vision/image_classifier_test.py index 11941ce23..97fb30b32 100644 --- a/mediapipe/tasks/python/test/vision/image_classifier_test.py +++ b/mediapipe/tasks/python/test/vision/image_classifier_test.py @@ -147,12 +147,10 @@ class ImageClassifierTest(parameterized.TestCase): self.assertIsInstance(classifier, _ImageClassifier) def test_create_from_options_fails_with_invalid_model_path(self): - # Invalid empty model path. with self.assertRaisesRegex( - ValueError, - r"ExternalFile must specify at least one of 'file_content', " - r"'file_name', 'file_pointer_meta' or 'file_descriptor_meta'."): - base_options = _BaseOptions(model_asset_path='') + RuntimeError, 'Unable to open file at /path/to/invalid/model.tflite'): + base_options = _BaseOptions( + model_asset_path='/path/to/invalid/model.tflite') options = _ImageClassifierOptions(base_options=base_options) _ImageClassifier.create_from_options(options) diff --git a/mediapipe/tasks/python/test/vision/image_segmenter_test.py b/mediapipe/tasks/python/test/vision/image_segmenter_test.py index 5072d3482..7f0b47eb7 100644 --- a/mediapipe/tasks/python/test/vision/image_segmenter_test.py +++ b/mediapipe/tasks/python/test/vision/image_segmenter_test.py @@ -97,12 +97,10 @@ class ImageSegmenterTest(parameterized.TestCase): self.assertIsInstance(segmenter, _ImageSegmenter) def test_create_from_options_fails_with_invalid_model_path(self): - # Invalid empty model path. with self.assertRaisesRegex( - ValueError, - r"ExternalFile must specify at least one of 'file_content', " - r"'file_name', 'file_pointer_meta' or 'file_descriptor_meta'."): - base_options = _BaseOptions(model_asset_path='') + RuntimeError, 'Unable to open file at /path/to/invalid/model.tflite'): + base_options = _BaseOptions( + model_asset_path='/path/to/invalid/model.tflite') options = _ImageSegmenterOptions(base_options=base_options) _ImageSegmenter.create_from_options(options) diff --git a/mediapipe/tasks/python/test/vision/object_detector_test.py b/mediapipe/tasks/python/test/vision/object_detector_test.py index 53c64427f..5afa31459 100644 --- a/mediapipe/tasks/python/test/vision/object_detector_test.py +++ b/mediapipe/tasks/python/test/vision/object_detector_test.py @@ -119,12 +119,10 @@ class ObjectDetectorTest(parameterized.TestCase): self.assertIsInstance(detector, _ObjectDetector) def test_create_from_options_fails_with_invalid_model_path(self): - # Invalid empty model path. with self.assertRaisesRegex( - ValueError, - r"ExternalFile must specify at least one of 'file_content', " - r"'file_name', 'file_pointer_meta' or 'file_descriptor_meta'."): - base_options = _BaseOptions(model_asset_path='') + RuntimeError, 'Unable to open file at /path/to/invalid/model.tflite'): + base_options = _BaseOptions( + model_asset_path='/path/to/invalid/model.tflite') options = _ObjectDetectorOptions(base_options=base_options) _ObjectDetector.create_from_options(options)