Coverage for hdl_registers/test/unit/test_register_python_generator.py: 100%

11 statements  

« prev     ^ index     » next       coverage.py v6.4.4, created at 2022-09-29 22:03 +0000

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

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

3# 

4# This file is part of the hdl_registers project, a HDL register generator fast enough to be run 

5# in real time. 

6# https://hdl-registers.com 

7# https://gitlab.com/tsfpga/hdl_registers 

8# -------------------------------------------------------------------------------------------------- 

9 

10from tsfpga.system_utils import load_python_module 

11 

12from hdl_registers import HDL_REGISTERS_TEST 

13from hdl_registers.parser import from_toml 

14 

15 

16def test_recreating_register_list_object(tmp_path): 

17 toml_file = HDL_REGISTERS_TEST / "regs_test.toml" 

18 test_regs = from_toml("test", toml_file) 

19 test_regs.create_python_class(tmp_path) 

20 

21 test_recreated = load_python_module(tmp_path / "test.py").Test() 

22 assert repr(test_recreated) == repr(test_regs) 

23 

24 test_recreated = load_python_module(tmp_path / "test.py").get_register_list() 

25 assert repr(test_recreated) == repr(test_regs)