summaryrefslogtreecommitdiffstats
path: root/tests/python/test_enums.py
blob: 3db64c1af690cc3593f0370b7962dc7f786841cf (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
32
33
34
35
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

import hamcrest
import pytest

from lsprotocol import types as lsp


@pytest.mark.parametrize(
    ("value", "expected"),
    [
        ("refactor", lsp.CodeActionKind.Refactor),
        (lsp.CodeActionKind.Refactor, lsp.CodeActionKind.Refactor),
        ("namespace", lsp.SemanticTokenTypes.Namespace),
        (lsp.SemanticTokenTypes.Namespace, lsp.SemanticTokenTypes.Namespace),
        ("declaration", lsp.SemanticTokenModifiers.Declaration),
        (
            lsp.SemanticTokenModifiers.Declaration,
            lsp.SemanticTokenModifiers.Declaration,
        ),
        ("comment", lsp.FoldingRangeKind.Comment),
        (lsp.FoldingRangeKind.Comment, lsp.FoldingRangeKind.Comment),
        ("utf-8", lsp.PositionEncodingKind.Utf8),
        (lsp.PositionEncodingKind.Utf8, lsp.PositionEncodingKind.Utf8),
        (1, lsp.WatchKind.Create),
        (lsp.WatchKind.Create, lsp.WatchKind.Create),
        (-32700, lsp.ErrorCodes.ParseError),
        (lsp.ErrorCodes.ParseError, lsp.ErrorCodes.ParseError),
        (-32803, lsp.LSPErrorCodes.RequestFailed),
        (lsp.LSPErrorCodes.RequestFailed, lsp.LSPErrorCodes.RequestFailed),
    ],
)
def test_custom_enum_types(value, expected):
    hamcrest.assert_that(value, hamcrest.is_(expected))