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

12 statements  

« prev     ^ index     » next       coverage.py v6.5.0, created at 2022-11-29 20:01 +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://gitlab.com/tsfpga/tsfpga 

7# -------------------------------------------------------------------------------------------------- 

8 

9# Standard libraries 

10from pathlib import Path 

11 

12# Third party libraries 

13import pytest 

14 

15# First party libraries 

16from tsfpga.ip_core_file import IpCoreFile 

17 

18 

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)) 

22 

23 

24def test_name(): 

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

26 

27 

28def test_name_with_spaces_should_raise_exception(): 

29 with pytest.raises(ValueError) as exception_info: 

30 # pylint: disable=expression-not-assigned 

31 IpCoreFile(Path("/apa/my core.tcl")).name 

32 assert str(exception_info.value) == "File name may not contain spaces: /apa/my core.tcl"