blob: bd7ca3778c63b42f6055e223a59905b275b8c2fc [file] [log] [blame]
Louis Verhaard7db78962020-05-25 15:05:26 +02001# Copyright (C) 2020 Arm Limited or its affiliates. All rights reserved.
2#
3# SPDX-License-Identifier: Apache-2.0
4#
5# Licensed under the Apache License, Version 2.0 (the License); you may
6# not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an AS IS BASIS, WITHOUT
13# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16# Description:
17# Unit tests for model_reader.
18import pytest
Louis Verhaard0b8268a2020-08-05 16:11:29 +020019
Louis Verhaard7db78962020-05-25 15:05:26 +020020from ethosu.vela import model_reader
21from ethosu.vela.errors import InputFileError
22
23
24def test_read_model_incorrect_extension(tmpdir):
25 # Tests read_model with a file name that does not end with .tflite
26 with pytest.raises(InputFileError):
27 model_reader.read_model("no_tflite_file.txt", model_reader.ModelReaderOptions())
28
29
Louis Verhaard7db78962020-05-25 15:05:26 +020030def test_read_model_file_not_found(tmpdir):
31 # Tests read_model with a .tflite file that does not exist
Tim Hallc8310b12020-06-17 14:53:11 +010032 with pytest.raises(FileNotFoundError):
Louis Verhaard7db78962020-05-25 15:05:26 +020033 model_reader.read_model("non_existing.tflite", model_reader.ModelReaderOptions())