Debian Codegraph @

tests/test_dump_n_load.py

raw symbols SCIP
1 from pathlib import Path
2
3 import pytest
4
5 from pytermgui import FileLoader, JsonLoader, YamlLoader, prettifiers
6
7 # TODO: Once dumping is once again more supported that should be included
8 # here as well.
9
10
11 class BaseLoaderTester:
12
13 path: Path
14 loader: FileLoader
15
16 @pytest.fixture(autouse=True)
17 def _setup(self):
18 self.loader = type(self).loader()
19
20 with self.loader as loader, open(self.path) as yaml:
21 self.namespace = loader.load(yaml)
22
23 def test_namespace_widget_length(self):
24 assert len(self.namespace.widgets) == 1
25
26
27 class TestYamlLoader(BaseLoaderTester):
28 loader = YamlLoader
29 path = Path("tests/test.yaml")
30
31
32 class TestJsonLoader(BaseLoaderTester):
33 loader = JsonLoader
34 path = Path("tests/test.json")