Update "test_create_from_options_fails_with_invalid_model_path" of all tasks python api tests.
PiperOrigin-RevId: 486990017
This commit is contained in:
parent
5e6842aa5c
commit
5c8b95666a
|
@ -174,12 +174,10 @@ class AudioClassifierTest(parameterized.TestCase):
|
||||||
self.assertIsInstance(classifier, _AudioClassifier)
|
self.assertIsInstance(classifier, _AudioClassifier)
|
||||||
|
|
||||||
def test_create_from_options_fails_with_invalid_model_path(self):
|
def test_create_from_options_fails_with_invalid_model_path(self):
|
||||||
# Invalid empty model path.
|
|
||||||
with self.assertRaisesRegex(
|
with self.assertRaisesRegex(
|
||||||
ValueError,
|
RuntimeError, 'Unable to open file at /path/to/invalid/model.tflite'):
|
||||||
r"ExternalFile must specify at least one of 'file_content', "
|
base_options = _BaseOptions(
|
||||||
r"'file_name', 'file_pointer_meta' or 'file_descriptor_meta'."):
|
model_asset_path='/path/to/invalid/model.tflite')
|
||||||
base_options = _BaseOptions(model_asset_path='')
|
|
||||||
options = _AudioClassifierOptions(base_options=base_options)
|
options = _AudioClassifierOptions(base_options=base_options)
|
||||||
_AudioClassifier.create_from_options(options)
|
_AudioClassifier.create_from_options(options)
|
||||||
|
|
||||||
|
|
|
@ -154,12 +154,10 @@ class ImageClassifierTest(parameterized.TestCase):
|
||||||
self.assertIsInstance(classifier, _TextClassifier)
|
self.assertIsInstance(classifier, _TextClassifier)
|
||||||
|
|
||||||
def test_create_from_options_fails_with_invalid_model_path(self):
|
def test_create_from_options_fails_with_invalid_model_path(self):
|
||||||
# Invalid empty model path.
|
|
||||||
with self.assertRaisesRegex(
|
with self.assertRaisesRegex(
|
||||||
ValueError,
|
RuntimeError, 'Unable to open file at /path/to/invalid/model.tflite'):
|
||||||
r"ExternalFile must specify at least one of 'file_content', "
|
base_options = _BaseOptions(
|
||||||
r"'file_name', 'file_pointer_meta' or 'file_descriptor_meta'."):
|
model_asset_path='/path/to/invalid/model.tflite')
|
||||||
base_options = _BaseOptions(model_asset_path='')
|
|
||||||
options = _TextClassifierOptions(base_options=base_options)
|
options = _TextClassifierOptions(base_options=base_options)
|
||||||
_TextClassifier.create_from_options(options)
|
_TextClassifier.create_from_options(options)
|
||||||
|
|
||||||
|
|
|
@ -147,12 +147,10 @@ class ImageClassifierTest(parameterized.TestCase):
|
||||||
self.assertIsInstance(classifier, _ImageClassifier)
|
self.assertIsInstance(classifier, _ImageClassifier)
|
||||||
|
|
||||||
def test_create_from_options_fails_with_invalid_model_path(self):
|
def test_create_from_options_fails_with_invalid_model_path(self):
|
||||||
# Invalid empty model path.
|
|
||||||
with self.assertRaisesRegex(
|
with self.assertRaisesRegex(
|
||||||
ValueError,
|
RuntimeError, 'Unable to open file at /path/to/invalid/model.tflite'):
|
||||||
r"ExternalFile must specify at least one of 'file_content', "
|
base_options = _BaseOptions(
|
||||||
r"'file_name', 'file_pointer_meta' or 'file_descriptor_meta'."):
|
model_asset_path='/path/to/invalid/model.tflite')
|
||||||
base_options = _BaseOptions(model_asset_path='')
|
|
||||||
options = _ImageClassifierOptions(base_options=base_options)
|
options = _ImageClassifierOptions(base_options=base_options)
|
||||||
_ImageClassifier.create_from_options(options)
|
_ImageClassifier.create_from_options(options)
|
||||||
|
|
||||||
|
|
|
@ -97,12 +97,10 @@ class ImageSegmenterTest(parameterized.TestCase):
|
||||||
self.assertIsInstance(segmenter, _ImageSegmenter)
|
self.assertIsInstance(segmenter, _ImageSegmenter)
|
||||||
|
|
||||||
def test_create_from_options_fails_with_invalid_model_path(self):
|
def test_create_from_options_fails_with_invalid_model_path(self):
|
||||||
# Invalid empty model path.
|
|
||||||
with self.assertRaisesRegex(
|
with self.assertRaisesRegex(
|
||||||
ValueError,
|
RuntimeError, 'Unable to open file at /path/to/invalid/model.tflite'):
|
||||||
r"ExternalFile must specify at least one of 'file_content', "
|
base_options = _BaseOptions(
|
||||||
r"'file_name', 'file_pointer_meta' or 'file_descriptor_meta'."):
|
model_asset_path='/path/to/invalid/model.tflite')
|
||||||
base_options = _BaseOptions(model_asset_path='')
|
|
||||||
options = _ImageSegmenterOptions(base_options=base_options)
|
options = _ImageSegmenterOptions(base_options=base_options)
|
||||||
_ImageSegmenter.create_from_options(options)
|
_ImageSegmenter.create_from_options(options)
|
||||||
|
|
||||||
|
|
|
@ -119,12 +119,10 @@ class ObjectDetectorTest(parameterized.TestCase):
|
||||||
self.assertIsInstance(detector, _ObjectDetector)
|
self.assertIsInstance(detector, _ObjectDetector)
|
||||||
|
|
||||||
def test_create_from_options_fails_with_invalid_model_path(self):
|
def test_create_from_options_fails_with_invalid_model_path(self):
|
||||||
# Invalid empty model path.
|
|
||||||
with self.assertRaisesRegex(
|
with self.assertRaisesRegex(
|
||||||
ValueError,
|
RuntimeError, 'Unable to open file at /path/to/invalid/model.tflite'):
|
||||||
r"ExternalFile must specify at least one of 'file_content', "
|
base_options = _BaseOptions(
|
||||||
r"'file_name', 'file_pointer_meta' or 'file_descriptor_meta'."):
|
model_asset_path='/path/to/invalid/model.tflite')
|
||||||
base_options = _BaseOptions(model_asset_path='')
|
|
||||||
options = _ObjectDetectorOptions(base_options=base_options)
|
options = _ObjectDetectorOptions(base_options=base_options)
|
||||||
_ObjectDetector.create_from_options(options)
|
_ObjectDetector.create_from_options(options)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user