Tests for abstract method enforcement.
| 292 | |
| 293 | |
| 294 | class TestBaseAPIAbstract: |
| 295 | """Tests for abstract method enforcement.""" |
| 296 | |
| 297 | def test_cannot_instantiate_base_api(self): |
| 298 | """Test that BaseAPI cannot be instantiated directly.""" |
| 299 | from datastudio.models.base import BaseAPI |
| 300 | |
| 301 | # BaseAPI is not truly abstract in Python, but generate_inner raises NotImplementedError |
| 302 | api = BaseAPI() |
| 303 | with pytest.raises(NotImplementedError): |
| 304 | api.generate_inner([]) |
| 305 | |
| 306 | def test_must_implement_generate_inner(self): |
| 307 | """Test that subclass must implement generate_inner.""" |
| 308 | from datastudio.models.base import BaseAPI |
| 309 | |
| 310 | class IncompleteAPI(BaseAPI): |
| 311 | pass |
| 312 | |
| 313 | api = IncompleteAPI() |
| 314 | with pytest.raises(NotImplementedError): |
| 315 | api.generate_inner([]) |
nothing calls this directly
no outgoing calls
no test coverage detected