Skip to content

Commit

Permalink
Import annotations in test modules
Browse files Browse the repository at this point in the history
  • Loading branch information
deathaxe committed Apr 21, 2024
1 parent d617447 commit c802e18
Show file tree
Hide file tree
Showing 25 changed files with 29 additions and 6 deletions.
7 changes: 3 additions & 4 deletions plugin/core/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
from abc import abstractproperty
from enum import IntEnum
from typing import Any, Callable, Dict, Generator, List, Optional, Protocol, Set, Tuple, Type, TypeVar, Union
from typing import cast, TYPE_CHECKING
from typing import cast
from typing_extensions import TypeGuard
from weakref import WeakSet
import functools
Expand All @@ -122,9 +122,8 @@
import sublime
import weakref

if TYPE_CHECKING:
InitCallback = Callable[[Session, bool], None]
T = TypeVar('T')
InitCallback = Callable[['Session', bool], None]
T = TypeVar('T')


def is_workspace_full_document_diagnostic_report(
Expand Down
1 change: 1 addition & 0 deletions tests/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
TODO: Untested on Windows.
"""
from __future__ import annotations
from argparse import ArgumentParser
from enum import IntEnum
from typing import Any, Callable, Dict, List, Optional, Tuple, Union, Iterable, Awaitable
Expand Down
1 change: 1 addition & 0 deletions tests/setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from LSP.plugin.core.promise import Promise
from LSP.plugin.core.logging import debug
from LSP.plugin.core.protocol import Notification, Request
Expand Down
1 change: 1 addition & 0 deletions tests/test_code_actions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from copy import deepcopy
from LSP.plugin.code_actions import get_matching_on_save_kinds, kinds_include_kind
from LSP.plugin.core.protocol import Point, Range
Expand Down
1 change: 1 addition & 0 deletions tests/test_collections.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from LSP.plugin.core.collections import DottedDict
from typing import Any
from unittest import TestCase
Expand Down
1 change: 1 addition & 0 deletions tests/test_completion.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from copy import deepcopy
from LSP.plugin.completion import format_completion
from LSP.plugin.completion import completion_with_defaults
Expand Down
1 change: 1 addition & 0 deletions tests/test_configs.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import sublime
from LSP.plugin.core.settings import read_client_config, update_client_config
from LSP.plugin.core.views import get_uri_and_position_from_location
Expand Down
1 change: 1 addition & 0 deletions tests/test_configurations.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from LSP.plugin.core.configurations import WindowConfigManager
from test_mocks import DISABLED_CONFIG
from test_mocks import TEST_CONFIG
Expand Down
1 change: 1 addition & 0 deletions tests/test_documents.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from LSP.plugin.core.logging import debug
from LSP.plugin.core.protocol import Request
from LSP.plugin.core.registry import windows
Expand Down
1 change: 1 addition & 0 deletions tests/test_edit.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from LSP.plugin import apply_text_edits
from LSP.plugin.core.edit import parse_workspace_edit
from LSP.plugin.core.protocol import TextDocumentEdit, TextEdit, WorkspaceEdit
Expand Down
1 change: 1 addition & 0 deletions tests/test_file_watcher.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from LSP.plugin import FileWatcher
from LSP.plugin import FileWatcherEvent
from LSP.plugin import FileWatcherEventType
Expand Down
5 changes: 3 additions & 2 deletions tests/test_message_request_handler.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import unittest
from test_mocks import MockSession
from __future__ import annotations
from LSP.plugin.core.message_request_handler import MessageRequestHandler
from test_mocks import MockSession
import sublime
import unittest


class MessageRequestHandlerTest(unittest.TestCase):
Expand Down
1 change: 1 addition & 0 deletions tests/test_mocks.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from LSP.plugin.core.logging import debug
from LSP.plugin.core.protocol import Notification
from LSP.plugin.core.protocol import Request
Expand Down
1 change: 1 addition & 0 deletions tests/test_protocol.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from LSP.plugin.core.protocol import Point, Position, Range, Request, Notification
from LSP.plugin.core.transports import JsonRpcProcessor
import unittest
Expand Down
1 change: 1 addition & 0 deletions tests/test_rename_panel.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from LSP.plugin.rename import utf16_to_code_points
import unittest

Expand Down
1 change: 1 addition & 0 deletions tests/test_server_notifications.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from LSP.plugin.core.protocol import DiagnosticSeverity
from LSP.plugin.core.protocol import DiagnosticTag
from LSP.plugin.core.protocol import PublishDiagnosticsParams
Expand Down
1 change: 1 addition & 0 deletions tests/test_server_panel_circular.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from LSP.plugin.core.panels import MAX_LOG_LINES_LIMIT_ON
from LSP.plugin.core.panels import PanelName
from LSP.plugin.core.registry import windows
Expand Down
1 change: 1 addition & 0 deletions tests/test_server_requests.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from LSP.plugin.core.protocol import ErrorCodes
from LSP.plugin.core.protocol import TextDocumentSyncKind
from LSP.plugin.core.sessions import SessionBufferProtocol
Expand Down
1 change: 1 addition & 0 deletions tests/test_session.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from LSP.plugin.core.collections import DottedDict
from LSP.plugin.core.protocol import Diagnostic
from LSP.plugin.core.protocol import DocumentUri
Expand Down
1 change: 1 addition & 0 deletions tests/test_signature_help.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from LSP.plugin.core.protocol import SignatureHelp
from LSP.plugin.core.signature_help import SigHelp
import sublime
Expand Down
1 change: 1 addition & 0 deletions tests/test_single_document.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from copy import deepcopy
from LSP.plugin import apply_text_edits, Request
from LSP.plugin.core.protocol import UINT_MAX
Expand Down
1 change: 1 addition & 0 deletions tests/test_types.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from LSP.plugin.core.types import diff
from LSP.plugin.core.types import basescope2languageid
from LSP.plugin.core.types import DocumentSelector
Expand Down
1 change: 1 addition & 0 deletions tests/test_url.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from LSP.plugin.core.url import filename_to_uri
from LSP.plugin.core.url import parse_uri
from LSP.plugin.core.url import view_to_uri
Expand Down
1 change: 1 addition & 0 deletions tests/test_views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from copy import deepcopy
from LSP.plugin.core.protocol import CodeActionKind
from LSP.plugin.core.protocol import Diagnostic
Expand Down
1 change: 1 addition & 0 deletions tests/test_workspace.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
from LSP.plugin.core.workspace import sorted_workspace_folders, is_subpath_of, WorkspaceFolder
import os
import unittest
Expand Down

0 comments on commit c802e18

Please sign in to comment.