Coverage for tsfpga/test/test_ip_core_file.py: 100%

13 statements  

« prev     ^ index     » next       coverage.py v7.6.12, created at 2025-02-21 20:51 +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# -------------------------------------------------------------------------------------------------- 

8 

9from pathlib import Path 

10 

11import pytest 

12 

13from tsfpga.ip_core_file import IpCoreFile 

14 

15 

16def test_can_cast_to_string_without_error(): 

17 str(IpCoreFile(Path("/apa/my_core.tcl"))) 

18 str(IpCoreFile(Path("/apa/my_core.tcl"), apa=123, hest="true", zebra=False)) 

19 

20 

21def test_name(): 

22 assert IpCoreFile(Path("/apa/my_core.tcl")).name == "my_core" 

23 

24 

25def test_name_with_spaces_should_raise_exception(): 

26 path = Path("/apa/my core.tcl") 

27 with pytest.raises(ValueError) as exception_info: 

28 _ = IpCoreFile(path).name 

29 assert str(exception_info.value) == f"File name may not contain spaces: {path}"