File: test_enums.py

package info (click to toggle)
lsprotocol 2025.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,408 kB
  • sloc: python: 7,567; cs: 1,225; sh: 15; makefile: 4
file content (35 lines) | stat: -rw-r--r-- 1,345 bytes parent folder | download | duplicates (3)
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))