MCPcopy Create free account
hub / github.com/Open-Bee/DataStudio / TestBaseFormat

Class TestBaseFormat

tests/datasets/test_formatters.py:26–73  ·  view source on GitHub ↗

Tests for BaseFormat abstract class.

Source from the content-addressed store, hash-verified

24
25
26class TestBaseFormat:
27 """Tests for BaseFormat abstract class."""
28
29 def test_base_format_is_abstract(self):
30 """Test that BaseFormat cannot be instantiated directly."""
31 with pytest.raises(TypeError):
32 BaseFormat()
33
34 def test_base_format_requires_extensions(self):
35 """Test that subclass must implement extensions property."""
36
37 class IncompleteFormat(BaseFormat):
38 def load(self, file_path):
39 pass
40
41 def save(self, data, file_path, **kwargs):
42 pass
43
44 with pytest.raises(TypeError):
45 IncompleteFormat()
46
47 def test_base_format_requires_load(self):
48 """Test that subclass must implement load method."""
49
50 class IncompleteFormat(BaseFormat):
51 @property
52 def extensions(self):
53 return [".test"]
54
55 def save(self, data, file_path, **kwargs):
56 pass
57
58 with pytest.raises(TypeError):
59 IncompleteFormat()
60
61 def test_base_format_requires_save(self):
62 """Test that subclass must implement save method."""
63
64 class IncompleteFormat(BaseFormat):
65 @property
66 def extensions(self):
67 return [".test"]
68
69 def load(self, file_path):
70 pass
71
72 with pytest.raises(TypeError):
73 IncompleteFormat()
74
75
76class TestJsonFormat:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected