Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

2.0 KB
Raw Blame
"""Shared fixtures for exporters tests."""

import pytest

from local_deep_research.exporters.odt_exporter import ODTExporter


@pytest.fixture(autouse=True)
def _clear_odt_sandbox_probe_cache():
    """``ODTExporter._pandoc_supports_sandbox`` is lru_cached per
    process. Clear it around every exporter test so no result depends
    on which test (real pandoc or a mocked ``pypandoc``) probed first.
    """
    probe = ODTExporter._pandoc_supports_sandbox
    probe.cache_clear()
    yield
    probe.cache_clear()


@pytest.fixture
def sample_markdown():
    """Sample markdown content for testing."""
    return """# Test Document

This is a test document with **bold** and *italic* text.

## Section 1

A paragraph with some content.

| Column 1 | Column 2 |
|----------|----------|
| Data 1   | Data 2   |

## Section 2

- Item 1
- Item 2
- Item 3

```python
def example():
    return "code block"
```

## Sources

[1] First Source Title
URL: https://example.com/source1

[2] Second Source Title
URL: https://example.com/source2
"""


@pytest.fixture
def simple_markdown():
    """Minimal markdown for basic tests."""
    return "# Hello World\n\nThis is a test."


@pytest.fixture
def markdown_with_special_chars():
    """Markdown with special characters."""
    return """# Special Characters

Testing: <>&"'
Unicode: café, naïve, 日本語
Symbols: © ® ™ € £ ¥
"""


@pytest.fixture
def sample_metadata():
    """Sample metadata for document generation."""
    return {
        "author": "Test Author",
        "date": "2024-01-15",
        "subject": "Test Subject",
    }


@pytest.fixture
def markdown_with_nested_lists():
    """Markdown with nested lists."""
    return """# Nested Lists

## Unordered
- Item 1
  - Nested 1.1
  - Nested 1.2
- Item 2

## Ordered
1. First
2. Second
   1. Nested 2.1
3. Third
"""


@pytest.fixture
def markdown_with_links():
    """Markdown with hyperlinks."""
    return """# Document with Links

Check out [this link](https://example.com) for more info.

Also see [another link](https://test.org/page).
"""