summaryrefslogtreecommitdiff
path: root/tests/test_numversion.py
blob: d19c6a31eb87676d97cd7949ffb6986acfd2cd85 (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
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt

from __future__ import annotations

import pytest

from pylint.__pkginfo__ import get_numversion_from_version


@pytest.mark.parametrize(
    "version,expected_numversion",
    [
        ["2.8.1", (2, 8, 1)],
        ["2.8.2+", (2, 8, 2)],
        ["3.0.0a0", (3, 0, 0)],
        ["3..0", (3, 0, 0)],
        ["1.a", (1, 0, 0)],
        ["", (0, 0, 0)],
        ["3.0.0b1", (3, 0, 0)],
        ["3.0.0rc1", (3, 0, 0)],
        ["3.0.0dev-234324234234f23abc4", (3, 0, 0)],
        ["pylint-2.4.7", (2, 4, 7)],
        ["2.8.3.dev3+g28c093c2.d20210428", (2, 8, 3)],
    ],
)
def test_numversion(version: str, expected_numversion: tuple[int, int, int]) -> None:
    assert get_numversion_from_version(version) == expected_numversion