blob: 50f2b6e0dc139bb111c4fcb0cefc8e00309a0de3 (
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
|
# 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():
root = pathlib.Path(__file__).parent.parent / "generator"
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)
|