Coverage for tsfpga/test/test_ip_core_file.py: 100%
13 statements
« prev ^ index » next coverage.py v7.6.9, created at 2024-12-20 20:52 +0000
« prev ^ index » next coverage.py v7.6.9, created at 2024-12-20 20:52 +0000
1# --------------------------------------------------------------------------------------------------
2# Copyright (c) Lukas Vik. All rights reserved.
3#
4# This file is part of the tsfpga project, a project platform for modern FPGA development.
5# https://tsfpga.com
6# https://github.com/tsfpga/tsfpga
7# --------------------------------------------------------------------------------------------------
9# Standard libraries
10from pathlib import Path
12# Third party libraries
13import pytest
15# First party libraries
16from tsfpga.ip_core_file import IpCoreFile
19def test_can_cast_to_string_without_error():
20 str(IpCoreFile(Path("/apa/my_core.tcl")))
21 str(IpCoreFile(Path("/apa/my_core.tcl"), apa=123, hest="true", zebra=False))
24def test_name():
25 assert IpCoreFile(Path("/apa/my_core.tcl")).name == "my_core"
28def test_name_with_spaces_should_raise_exception():
29 path = Path("/apa/my core.tcl")
30 with pytest.raises(ValueError) as exception_info:
31 # pylint: disable=expression-not-assigned
32 IpCoreFile(path).name
33 assert str(exception_info.value) == f"File name may not contain spaces: {path}"