# This file is auto-generated by alef — DO NOT EDIT.
# alef:hash:4e15143f4af1ae8bafbdb1506ef057da924484c66a19483966333558ad437e75
# To regenerate: alef generate
# To verify freshness: alef verify --exit-code
# Issues & docs: https://github.com/kreuzberg-dev/alef

"""E2e tests for category: plugin_api."""

import pytest  # noqa: F401
from kreuzberg import register_document_extractor, register_embedding_backend, register_ocr_backend, register_post_processor, register_renderer, register_validator, unregister_document_extractor, unregister_embedding_backend, unregister_post_processor, unregister_renderer, unregister_validator, unregister_ocr_backend


def _alef_e2e_text(value: object) -> str:
    return "" if value is None else str(value)


def _alef_e2e_item_texts(item: object) -> tuple[str, ...]:
    raw_items = getattr(item, "items", None)
    items_text = " ".join(str(value) for value in raw_items) if isinstance(raw_items, list) else ""
    return (
        _alef_e2e_text(item),
        _alef_e2e_text(getattr(item, "kind", None)),
        _alef_e2e_text(getattr(item, "name", None)),
        _alef_e2e_text(getattr(item, "source", None)),
        _alef_e2e_text(getattr(item, "alias", None)),
        _alef_e2e_text(getattr(item, "text", None)),
        _alef_e2e_text(getattr(item, "signature", None)),
        items_text,
    )


def test_register_document_extractor_trait_bridge() -> None:
    """register_document_extractor: trait bridge."""
    class _TestStub_register_document_extractor_trait_bridge:
        def name(self):
            return "test-extractor"
        def initialize(self):
            pass
        def shutdown(self):
            pass
        async def extract_bytes(self, _p0, _p1, _p2):
            return {}
        def supported_mime_types(self):
            return []


    _ = register_document_extractor(_TestStub_register_document_extractor_trait_bridge())
    unregister_document_extractor("test-extractor")


def test_register_embedding_backend_trait_bridge() -> None:
    """register_embedding_backend: trait bridge."""
    class _TestStub_register_embedding_backend_trait_bridge:
        def name(self):
            return "test-embedding-backend"
        def initialize(self):
            pass
        def shutdown(self):
            pass
        def dimensions(self):
            return 1
        async def embed(self, _p0):
            return []


    _ = register_embedding_backend(_TestStub_register_embedding_backend_trait_bridge())
    unregister_embedding_backend("test-embedding-backend")


def test_register_ocr_backend_trait_bridge() -> None:
    """register_ocr_backend: trait bridge."""
    class _TestStub_register_ocr_backend_trait_bridge:
        def name(self):
            return "test-backend"
        def initialize(self):
            pass
        def shutdown(self):
            pass
        async def process_image(self, _p0, _p1):
            return {}
        def supports_language(self, _p0):
            return False
        def backend_type(self):
            return {}


    _ = register_ocr_backend(_TestStub_register_ocr_backend_trait_bridge())
    unregister_ocr_backend("test-backend")


def test_register_post_processor_trait_bridge() -> None:
    """register_post_processor: trait bridge."""
    class _TestStub_register_post_processor_trait_bridge:
        def name(self):
            return "test-processor"
        def initialize(self):
            pass
        def shutdown(self):
            pass
        async def process(self, _p0, _p1):
            return None
        def processing_stage(self):
            return {}


    _ = register_post_processor(_TestStub_register_post_processor_trait_bridge())
    unregister_post_processor("test-processor")


def test_register_renderer_trait_bridge() -> None:
    """register_renderer: trait bridge."""
    class _TestStub_register_renderer_trait_bridge:
        def name(self):
            return "test-renderer"
        def initialize(self):
            pass
        def shutdown(self):
            pass
        def render(self, _p0):
            return ""


    _ = register_renderer(_TestStub_register_renderer_trait_bridge())
    unregister_renderer("test-renderer")


def test_register_validator_trait_bridge() -> None:
    """register_validator: trait bridge."""
    class _TestStub_register_validator_trait_bridge:
        def name(self):
            return "test-validator"
        def initialize(self):
            pass
        def shutdown(self):
            pass
        async def validate(self, _p0, _p1):
            return None


    _ = register_validator(_TestStub_register_validator_trait_bridge())
    unregister_validator("test-validator")


def test_unregister_document_extractor_after_register() -> None:
    """unregister_document_extractor."""
    name = "test-extractor"

    _ = unregister_document_extractor(name)


def test_unregister_embedding_backend_after_register() -> None:
    """unregister_embedding_backend."""
    name = "test-embedding-backend"

    _ = unregister_embedding_backend(name)


def test_unregister_post_processor_after_register() -> None:
    """unregister_post_processor."""
    name = "test-processor"

    _ = unregister_post_processor(name)


def test_unregister_renderer_after_register() -> None:
    """unregister_renderer."""
    name = "test-renderer"

    _ = unregister_renderer(name)


def test_unregister_validator_after_register() -> None:
    """unregister_validator."""
    name = "test-validator"

    _ = unregister_validator(name)
