Spaces:
Running
Running
Download tests/test_config_backend_selection.py from Leon4gr45/brain: direct link, hf CLI and curl.
- Browser
- Download file 904 Bytes
-
https://huggingface.co/spaces/Leon4gr45/brain/resolve/main/tests/test_config_backend_selection.py
- Command line
-
hf download hf://spaces/Leon4gr45/brain/tests/test_config_backend_selection.py
-
curl -L -o test_config_backend_selection.py https://huggingface.co/spaces/Leon4gr45/brain/resolve/main/tests/test_config_backend_selection.py
904 Bytes
| import os | |
| import pytest | |
| from src.config import Config | |
| def test_config_default_backends(monkeypatch): | |
| monkeypatch.delenv("DATA_DB", raising=False) | |
| monkeypatch.delenv("VECTOR_DB", raising=False) | |
| monkeypatch.delenv("GRAPH_DB", raising=False) | |
| monkeypatch.delenv("MONGO_PORT", raising=False) | |
| cfg = Config() | |
| assert cfg.mongo is not None | |
| assert cfg.milvus is not None | |
| assert cfg.neo4j is not None | |
| assert cfg.postgresql is None | |
| def test_config_postgres_profile(monkeypatch): | |
| monkeypatch.setenv("DATA_DB", "postgresql") | |
| monkeypatch.setenv("VECTOR_DB", "postgresql") | |
| monkeypatch.setenv("GRAPH_DB", "networkx") | |
| monkeypatch.delenv("MONGO_PORT", raising=False) | |
| monkeypatch.delenv("POSTGRES_PORT", raising=False) | |
| cfg = Config() | |
| assert cfg.mongo is None | |
| assert cfg.milvus is None | |
| assert cfg.neo4j is None | |
| assert cfg.postgresql is not None | |