Coverage for tests / unit / utils / unified_config / test_injectable.py: 100%

14 statements  

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

1"""Tests for is_tool_injectable function.""" 

2 

3from __future__ import annotations 

4 

5import pytest 

6from assertpy import assert_that 

7 

8from lintro.utils.unified_config import is_tool_injectable 

9 

10 

11@pytest.mark.parametrize( 

12 "tool_name", 

13 ["ruff", "black", "markdownlint", "yamllint"], 

14 ids=["ruff", "black", "markdownlint", "yamllint"], 

15) 

16def test_is_tool_injectable_returns_true_for_injectable_tools(tool_name: str) -> None: 

17 """Verify injectable tools are correctly identified. 

18 

19 Args: 

20 tool_name: Name of the tool. 

21 """ 

22 assert_that(is_tool_injectable(tool_name)).is_true() 

23 

24 

25@pytest.mark.parametrize( 

26 "tool_name", 

27 ["RUFF", "Black", "MarkdownLint"], 

28 ids=["RUFF_upper", "Black_mixed", "MarkdownLint_mixed"], 

29) 

30def test_is_tool_injectable_is_case_insensitive(tool_name: str) -> None: 

31 """Verify tool name matching is case-insensitive. 

32 

33 Args: 

34 tool_name: Name of the tool. 

35 """ 

36 assert_that(is_tool_injectable(tool_name)).is_true() 

37 

38 

39def test_is_tool_injectable_returns_false_for_unknown_tool() -> None: 

40 """Verify unknown tools are not marked as injectable.""" 

41 assert_that(is_tool_injectable("unknown_tool")).is_false() 

42 

43 

44def test_is_tool_injectable_returns_false_for_non_injectable_known_tools() -> None: 

45 """Verify known non-injectable tools return False.""" 

46 assert_that(is_tool_injectable("bandit")).is_false()