diff options
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) |