Coverage for tests / unit / formatters / styles / test_style_common.py: 100%
16 statements
« prev ^ index » next coverage.py v7.13.0, created at 2026-04-03 18:53 +0000
« prev ^ index » next coverage.py v7.13.0, created at 2026-04-03 18:53 +0000
1"""Cross-style parametrized tests for formatter styles.
3Tests common behaviors across all formatter styles using parametrization.
4"""
6from __future__ import annotations
8from typing import TYPE_CHECKING
10import pytest
11from assertpy import assert_that
13from lintro.formatters.styles.csv import CsvStyle
14from lintro.formatters.styles.github import GitHubStyle
15from lintro.formatters.styles.grid import GridStyle
16from lintro.formatters.styles.html import HtmlStyle
17from lintro.formatters.styles.markdown import MarkdownStyle
18from lintro.formatters.styles.plain import PlainStyle
20from .conftest import TWO_COLUMNS
22if TYPE_CHECKING:
23 from lintro.formatters.styles.base import BaseStyle
26@pytest.mark.parametrize(
27 ("style_class", "expected"),
28 [
29 pytest.param(PlainStyle, "No issues found.", id="plain"),
30 pytest.param(GridStyle, "", id="grid"),
31 pytest.param(HtmlStyle, "<p>No issues found.</p>", id="html"),
32 pytest.param(MarkdownStyle, "No issues found.", id="markdown"),
33 pytest.param(CsvStyle, "", id="csv"),
34 pytest.param(GitHubStyle, "", id="github"),
35 ],
36)
37def test_empty_rows_returns_expected_output(
38 style_class: type[BaseStyle],
39 expected: str,
40) -> None:
41 """Style returns appropriate output for empty rows.
43 Args:
44 style_class: The style class to test.
45 expected: The expected output string.
46 """
47 style = style_class()
48 result = style.format(TWO_COLUMNS, [])
49 assert_that(result).is_equal_to(expected)