"""Quick-win tests for re-export / compat modules at 0% coverage.

These modules just re-export symbols from subpackages. Importing them
and verifying the expected attributes exist is enough to cover them.
"""


class TestBenchmarkDatasets:
    """benchmarks/datasets.py — re-exports load_dataset etc."""

    def test_imports(self):
        from local_deep_research.benchmarks import datasets

        assert hasattr(datasets, "load_dataset")
        assert hasattr(datasets, "get_available_datasets")
        assert hasattr(datasets, "DEFAULT_DATASET_URLS")

    def test_callable(self):
        from local_deep_research.benchmarks.datasets import load_dataset

        assert callable(load_dataset)


class TestBenchmarkMetrics:
    """benchmarks/metrics.py — re-exports calculate_metrics, generate_report."""

    def test_imports(self):
        from local_deep_research.benchmarks import metrics

        assert hasattr(metrics, "calculate_metrics")
        assert hasattr(metrics, "generate_report")

    def test_callable(self):
        from local_deep_research.benchmarks.metrics import (
            calculate_metrics,
            generate_report,
        )

        assert callable(calculate_metrics)
        assert callable(generate_report)


class TestBenchmarkModels:
    """benchmarks/models/__init__.py — re-exports ORM models."""

    def test_imports(self):
        from local_deep_research.benchmarks import models

        assert hasattr(models, "BenchmarkRun")
        assert hasattr(models, "BenchmarkResult")
        assert hasattr(models, "BenchmarkConfig")
        assert hasattr(models, "BenchmarkProgress")
        assert hasattr(models, "BenchmarkStatus")
        assert hasattr(models, "DatasetType")


class TestRepositories:
    """advanced_search_system/repositories/__init__.py — re-exports FindingsRepository."""

    def test_imports(self):
        from local_deep_research.advanced_search_system import repositories

        assert hasattr(repositories, "FindingsRepository")


class TestSetupUtils:
    """utilities/setup_utils.py — wrapper calling init_config_files."""

    def test_module_importable(self):
        from local_deep_research.utilities import setup_utils

        assert hasattr(setup_utils, "setup_user_directories")
        assert callable(setup_utils.setup_user_directories)

    def test_setup_calls_init_config_files(self, monkeypatch):
        """Mock the lazy import to verify setup_user_directories calls it."""
        import sys
        from unittest.mock import MagicMock

        # Create a fake config.config_files module
        fake_module = MagicMock()
        monkeypatch.setitem(
            sys.modules,
            "local_deep_research.config.config_files",
            fake_module,
        )
        from local_deep_research.utilities.setup_utils import (
            setup_user_directories,
        )

        setup_user_directories()
        fake_module.init_config_files.assert_called_once()
