Coverage for tests / unit / tools / oxlint / test_default_options.py: 100%

14 statements  

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

1"""Tests for OxlintPlugin default options.""" 

2 

3from __future__ import annotations 

4 

5from typing import TYPE_CHECKING 

6 

7import pytest 

8from assertpy import assert_that 

9 

10from lintro.tools.definitions.oxlint import OXLINT_DEFAULT_TIMEOUT 

11 

12if TYPE_CHECKING: 

13 from lintro.tools.definitions.oxlint import OxlintPlugin 

14 

15 

16@pytest.mark.parametrize( 

17 ("option_name", "expected_value"), 

18 [ 

19 ("timeout", OXLINT_DEFAULT_TIMEOUT), 

20 ("quiet", False), 

21 ], 

22 ids=[ 

23 "timeout_equals_default", 

24 "quiet_is_false", 

25 ], 

26) 

27def test_default_options_values( 

28 oxlint_plugin: OxlintPlugin, 

29 option_name: str, 

30 expected_value: object, 

31) -> None: 

32 """Default options have correct values. 

33 

34 Args: 

35 oxlint_plugin: The OxlintPlugin instance to test. 

36 option_name: The name of the option to check. 

37 expected_value: The expected value for the option. 

38 """ 

39 assert_that(oxlint_plugin.definition.default_options).contains_key(option_name) 

40 assert_that(oxlint_plugin.definition.default_options[option_name]).is_equal_to( 

41 expected_value, 

42 ) 

43 

44 

45def test_default_timeout_constant() -> None: 

46 """Test that OXLINT_DEFAULT_TIMEOUT has expected value.""" 

47 assert_that(OXLINT_DEFAULT_TIMEOUT).is_equal_to(30) 

48 

49 

50def test_plugin_options_initialized(oxlint_plugin: OxlintPlugin) -> None: 

51 """Test that plugin options are initialized with defaults. 

52 

53 Args: 

54 oxlint_plugin: The OxlintPlugin instance to test. 

55 """ 

56 assert_that(oxlint_plugin.options).contains_key("quiet") 

57 assert_that(oxlint_plugin.options["quiet"]).is_false()