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

12 statements  

« prev     ^ index     » next       coverage.py v6.4, created at 2022-05-28 04:01 +0000

1# -------------------------------------------------------------------------------------------------- 

2# Copyright (c) Lukas Vik. All rights reserved. 

3# 

4# This file is part of the tsfpga project. 

5# https://tsfpga.com 

6# https://gitlab.com/tsfpga/tsfpga 

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

8 

9from pathlib import Path 

10import pytest 

11 

12from tsfpga.ip_core_file import IpCoreFile 

13 

14 

15def test_can_cast_to_string_without_error(): 

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

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

18 

19 

20def test_name(): 

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

22 

23 

24def test_name_with_spaces_should_raise_exception(): 

25 with pytest.raises(ValueError) as exception_info: 

26 # pylint: disable=expression-not-assigned 

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

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