Home / Function/ test_reset_collection() — langchain Function Reference

test_reset_collection() — langchain Function Reference

Architecture documentation for the test_reset_collection() function in test_vectorstores.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  3d521cab_78b9_21ec_6667_7a4dc28d66a7["test_reset_collection()"]
  289e5a4f_8e2e_ddb6_af2e_804f91dabdb8["test_vectorstores.py"]
  3d521cab_78b9_21ec_6667_7a4dc28d66a7 -->|defined in| 289e5a4f_8e2e_ddb6_af2e_804f91dabdb8
  style 3d521cab_78b9_21ec_6667_7a4dc28d66a7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/chroma/tests/integration_tests/test_vectorstores.py lines 795–810

def test_reset_collection(client: chromadb.ClientAPI) -> None:
    """Tests ensure_collection method."""
    vectorstore = Chroma(
        client=client,
        collection_name="test_collection",
        embedding_function=FakeEmbeddings(),
    )
    vectorstore.add_documents([Document(page_content="foo")])
    assert vectorstore._collection.count() == 1
    vectorstore.reset_collection()
    assert vectorstore._chroma_collection is not None
    assert vectorstore._client.get_collection("test_collection") is not None
    assert vectorstore._collection.name == "test_collection"
    assert vectorstore._collection.count() == 0
    # Clean up
    vectorstore.delete_collection()

Domain

Subdomains

Frequently Asked Questions

What does test_reset_collection() do?
test_reset_collection() is a function in the langchain codebase, defined in libs/partners/chroma/tests/integration_tests/test_vectorstores.py.
Where is test_reset_collection() defined?
test_reset_collection() is defined in libs/partners/chroma/tests/integration_tests/test_vectorstores.py at line 795.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free