Download tests/unit/core/test_protocols.py from vertox-ai/speech-text-data-aligners: direct link, hf CLI and curl.
- Browser
- Download file 1.16 kB
-
https://huggingface.co/vertox-ai/speech-text-data-aligners/resolve/main/tests/unit/core/test_protocols.py
- Command line
-
hf download hf://vertox-ai/speech-text-data-aligners/tests/unit/core/test_protocols.py
-
curl -L -o test_protocols.py https://huggingface.co/vertox-ai/speech-text-data-aligners/resolve/main/tests/unit/core/test_protocols.py
1.16 kB
| # License: Apache-2.0 License | |
| # Created by: Patrick Lumbantobing, VertoX-AI | |
| # Copyright (c) 2026 VertoX-AI. All rights reserved. | |
| # | |
| # This work is licensed under the Apache-2.0 License. | |
| # To view a copy of this license, visit | |
| # https://www.apache.org/licenses/LICENSE-2.0 | |
| from __future__ import annotations | |
| from speech_text_data_aligners.core.models import ( | |
| AlignmentOutcome, | |
| AlignmentProvenance, | |
| AlignmentRequest, | |
| AlignmentResult, | |
| ) | |
| from speech_text_data_aligners.core.protocols import AlignmentBackend | |
| class FakeBackend: | |
| def name(self) -> str: | |
| return "fake" | |
| def align(self, request: AlignmentRequest) -> AlignmentResult: | |
| return AlignmentResult(request.request_id, (), AlignmentProvenance("fake")) | |
| def align_batch( | |
| self, requests: tuple[AlignmentRequest, ...] | |
| ) -> tuple[AlignmentOutcome, ...]: | |
| return tuple( | |
| AlignmentOutcome(result=self.align(request)) for request in requests | |
| ) | |
| def test_runtime_protocol_accepts_structural_backend() -> None: | |
| assert isinstance(FakeBackend(), AlignmentBackend) | |
| assert not isinstance(object(), AlignmentBackend) | |