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

6 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 hdl_registers.constant import Constant 

11 

12 

13def test_repr(): 

14 # Check that repr is an actual representation, not just "X object at 0xABCDEF" 

15 assert "apa" in repr(Constant(name="apa", value=0)) 

16 

17 # Different name 

18 assert repr(Constant(name="apa", value=0)) != repr(Constant(name="hest", value=0)) 

19 

20 # Different value 

21 assert repr(Constant(name="apa", value=0)) != repr(Constant(name="apa", value=1)) 

22 

23 # Different description 

24 assert repr(Constant(name="apa", value=0, description="Blah")) != repr( 

25 Constant(name="apa", value=0, description="Gaah") 

26 )