File: test_misc.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 (36 lines) | stat: -rw-r--r-- 978 bytes parent folder | download
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
36
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

import pytest
from hamcrest import assert_that, is_
from lsprotocol import types as lsp


@pytest.mark.parametrize(
    ("msg", "expected"),
    [
        (lsp.PROGRESS, "both"),
        (lsp.WORKSPACE_WILL_RENAME_FILES, "clientToServer"),
        (lsp.WORKSPACE_WORKSPACE_FOLDERS, "serverToClient"),
    ],
)
def test_message_direction(msg, expected):
    assert_that(lsp.message_direction(msg), is_(expected))


@pytest.mark.parametrize(
    ("cls", "expected"), [(lsp.CancelNotification, True), (lsp.CancelParams, False)]
)
def test_is_special_class(cls, expected):
    assert_that(lsp.is_special_class(cls), is_(expected))


@pytest.mark.parametrize(
    ("cls", "expected"),
    [
        (lsp.CancelNotification, False),
        (lsp.CallHierarchyIncomingCall, True),
    ],
)
def test_is_keyword_class(cls, expected):
    assert_that(lsp.is_keyword_class(cls), is_(expected))