summaryrefslogtreecommitdiff
path: root/tests/pyreverse/test_printer_factory.py
blob: 76406f0a8f5b3ebf2daf90354fe13e9af778371b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt

"""Unit tests for pylint.pyreverse.printer_factory."""

from __future__ import annotations

import pytest

from pylint.pyreverse import printer_factory
from pylint.pyreverse.dot_printer import DotPrinter
from pylint.pyreverse.plantuml_printer import PlantUmlPrinter
from pylint.pyreverse.printer import Printer
from pylint.pyreverse.vcg_printer import VCGPrinter


@pytest.mark.parametrize(
    "filetype, expected_printer_class",
    [
        ("vcg", VCGPrinter),
        ("dot", DotPrinter),
        ("puml", PlantUmlPrinter),
        ("plantuml", PlantUmlPrinter),
        ("png", DotPrinter),
    ],
)
def test_get_printer_for_filetype(
    filetype: str, expected_printer_class: type[Printer]
) -> None:
    assert printer_factory.get_printer_for_filetype(filetype) == expected_printer_class