File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 77logger = logging .getLogger (name = __name__ )
88
99
10- def get_database_connector (config : Config ) -> DatabaseConnectorBase : # pragma: nocover
10+ def get_database_connector (config : Config ) -> DatabaseConnectorBase :
1111 """
1212 It's CRUCIAL to keep the `import`s of the database connectors in the branches.
1313 This allow them to be lazy-imported. This also allow us to keep the main package
Original file line number Diff line number Diff line change 1+ import pytest
2+
3+ from vectorcode .cli_utils import Config
4+ from vectorcode .database import get_database_connector
5+ from vectorcode .database .chroma0 import ChromaDB0Connector
6+
7+
8+ def test_get_database_connector ():
9+ assert isinstance (
10+ get_database_connector (Config (db_type = "ChromaDB0" )), ChromaDB0Connector
11+ )
12+
13+
14+ def test_get_database_connector_invalid_type ():
15+ with pytest .raises (ValueError ):
16+ get_database_connector (Config (db_type = "InvalidDB" ))
You can’t perform that action at this time.
0 commit comments