Coverage for tests / unit / parsers / shellcheck_parser / test_issue_model.py: 100%

14 statements  

« prev     ^ index     » next       coverage.py v7.13.0, created at 2026-04-03 18:53 +0000

1"""Tests for ShellcheckIssue model methods.""" 

2 

3from __future__ import annotations 

4 

5from assertpy import assert_that 

6 

7from lintro.parsers.shellcheck.shellcheck_parser import parse_shellcheck_output 

8 

9from .conftest import make_issue, make_shellcheck_output 

10 

11 

12def test_to_display_row() -> None: 

13 """Test ShellcheckIssue to_display_row method.""" 

14 output = make_shellcheck_output( 

15 [ 

16 make_issue( 

17 file="script.sh", 

18 line=10, 

19 column=5, 

20 level="warning", 

21 code=2086, 

22 message="Test message", 

23 ), 

24 ], 

25 ) 

26 result = parse_shellcheck_output(output=output) 

27 

28 display_row = result[0].to_display_row() 

29 assert_that(display_row["file"]).is_equal_to("script.sh") 

30 assert_that(display_row["line"]).is_equal_to("10") 

31 assert_that(display_row["column"]).is_equal_to("5") 

32 assert_that(display_row["code"]).is_equal_to("SC2086") 

33 assert_that(display_row["message"]).is_equal_to("Test message") 

34 assert_that(display_row["severity"]).is_equal_to("WARNING")