Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added missing conditions in the TC's #25511

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions tensorflow/lite/python/interpreter_test.py
Expand Up @@ -113,6 +113,21 @@ def testInvokeBeforeReady(self):
'Invoke called on model that is not ready'):
interpreter.invoke()

def testInvalidModelFileContent(self):
with self.assertRaisesRegexp(
ValueError, '`model_path` or `model_content` must be specified.'):
interpreter_wrapper.Interpreter(model_path=None, model_content=None)

def testInvalidIndex(self):
interpreter = interpreter_wrapper.Interpreter(
model_path=resource_loader.get_path_to_datafile(
'testdata/permute_float.tflite'))
interpreter.allocate_tensors()
#Invalid tensor index passed.
with self.assertRaisesRegexp(
ValueError, 'Tensor with no shape found.'):
interpreter._get_tensor_details(4)


class InterpreterTensorAccessorTest(test_util.TensorFlowTestCase):

Expand Down