File: test_model.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 (24 lines) | stat: -rw-r--r-- 596 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
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

import json
import pathlib

import pytest

import generator.model as model

lsp_json_path = pathlib.Path(model.__file__).parent / "lsp.json"


def test_model_loading():
    json_model = json.loads((lsp_json_path).read_text(encoding="utf-8"))
    model.LSPModel(**json_model)


def test_model_loading_failure():
    json_model = json.loads((lsp_json_path).read_text(encoding="utf-8"))

    del json_model["structures"][0]["name"]
    with pytest.raises(TypeError):
        model.LSPModel(**json_model)