mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-15 07:36:08 +00:00
mongodb[patch]: Set delete_many only if count_documents is not 0 (#18402)
- [x] **PR message**: ***Delete this entire checklist*** and replace with - **Description:** Remove the assert statement on the `count_documents` in setup_class. It should just delete if there are documents present - **Issue:** the issue # Crashes on class setup - **Dependencies:** None - **Twitter handle:** @mongodb - [x] **Add tests and docs**: If you're adding a new integration, please include 1. N/A - [ ] **Lint and test**: Run `make format`, `make lint` and `make test` from the root of the package(s) you've modified. See contribution guidelines for more: https://python.langchain.com/docs/contributing/ Additional guidelines: - Make sure optional dependencies are imported within a function. - Please do not add dependencies to pyproject.toml files (even optional ones) unless they are required for unit tests. - Most PRs should not touch more than one package. - Changes should be backwards compatible. - If you are adding something to community, do not re-import it in langchain. If no one reviews your PR within a few days, please @-mention one of baskaryan, efriis, eyurtsev, hwchase17. Co-authored-by: Jib <jib@byblack.us>
This commit is contained in:
parent
c9153a3fd4
commit
c2b1abe91b
@ -50,7 +50,8 @@ class TestMongoDBAtlasVectorSearch:
|
||||
def setup_class(cls) -> None:
|
||||
# insure the test collection is empty
|
||||
collection = get_collection()
|
||||
assert collection.count_documents({}) == 0 # type: ignore[index] # noqa: E501
|
||||
if collection.count_documents({}):
|
||||
collection.delete_many({}) # type: ignore[index] # noqa: E501
|
||||
|
||||
@classmethod
|
||||
def teardown_class(cls) -> None:
|
||||
|
Loading…
Reference in New Issue
Block a user