diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 19:55:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 19:55:48 +0000 |
commit | 8be448d3881909fb0ce4b033cad71aa7575de0aa (patch) | |
tree | da33caff06645347a08c3c9c56dd703e4acb5aa3 /tests/generator/test_model.py | |
parent | Initial commit. (diff) | |
download | lsprotocol-upstream.tar.xz lsprotocol-upstream.zip |
Adding upstream version 2023.0.0.upstream/2023.0.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | tests/generator/test_model.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/generator/test_model.py b/tests/generator/test_model.py new file mode 100644 index 0000000..50f2b6e --- /dev/null +++ b/tests/generator/test_model.py @@ -0,0 +1,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) |