mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-03 17:11:24 +00:00
GraphConfig (extraction_model?, max_chunks?, gleanings=0; extra=forbid) on SourceConfig; settings GRAPHRAG_EXTRACTION_MODEL (None=instance default) + GRAPHRAG_MAX_CHUNKS_FOR_EXTRACTION; graphrag_available() = GRAPHRAG_ENABLED and VECTOR_STORE==pgvector (D27-D32 foundation). Unit G1.
32 lines
1.2 KiB
Python
32 lines
1.2 KiB
Python
"""Tests for the graphrag_available() pgvector-gated flag (D29)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
from application.graphrag import graphrag_available
|
|
from application.core.settings import settings
|
|
|
|
|
|
@pytest.mark.unit
|
|
class TestGraphragAvailable:
|
|
def test_true_only_when_enabled_and_pgvector(self, monkeypatch):
|
|
monkeypatch.setattr(settings, "GRAPHRAG_ENABLED", True)
|
|
monkeypatch.setattr(settings, "VECTOR_STORE", "pgvector")
|
|
assert graphrag_available() is True
|
|
|
|
def test_false_when_disabled(self, monkeypatch):
|
|
monkeypatch.setattr(settings, "GRAPHRAG_ENABLED", False)
|
|
monkeypatch.setattr(settings, "VECTOR_STORE", "pgvector")
|
|
assert graphrag_available() is False
|
|
|
|
def test_false_when_store_not_pgvector(self, monkeypatch):
|
|
monkeypatch.setattr(settings, "GRAPHRAG_ENABLED", True)
|
|
monkeypatch.setattr(settings, "VECTOR_STORE", "faiss")
|
|
assert graphrag_available() is False
|
|
|
|
def test_false_when_disabled_and_not_pgvector(self, monkeypatch):
|
|
monkeypatch.setattr(settings, "GRAPHRAG_ENABLED", False)
|
|
monkeypatch.setattr(settings, "VECTOR_STORE", "faiss")
|
|
assert graphrag_available() is False
|