Coverage for tests/output/formatting/test_path.py: 100%

9 statements  

« prev     ^ index     » next       coverage.py v6.5.0, created at 2023-02-09 12:09 +0100

1from __future__ import annotations 

2 

3from pathlib import Path 

4 

5from harbor_cli.output.formatting.path import path_link 

6 

7 

8def test_path_link_absolute() -> None: 

9 """Test path_link with absolute=True.""" 

10 p = Path("/tmp").resolve().absolute() 

11 assert path_link(p, absolute=True) == f"[link=file://{str(p)}]{str(p)}[/link]" 

12 

13 

14def test_path_link_relative() -> None: 

15 """Test path_link with absolute=False.""" 

16 p = Path("/tmp") 

17 assert ( 

18 path_link(p, absolute=False) 

19 == f"[link=file://{str(p.resolve().absolute())}]/tmp[/link]" 

20 )