Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
akotyla committed Oct 7, 2024
1 parent d306f84 commit 227fddc
Showing 1 changed file with 8 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import pytest

from ragbits.core.embeddings.noop import NoopEmbeddings
from ragbits.core.vector_store.in_memory import InMemoryVectorStore
from ragbits.document_search import DocumentSearch
from ragbits.document_search._main import SearchConfig
Expand All @@ -19,27 +18,16 @@
}


async def test_document_search():
document_search = DocumentSearch(embedder=NoopEmbeddings(), vector_store=InMemoryVectorStore())

await document_search.ingest_document(
DocumentMeta.create_text_document_from_literal("Name of Peppa's brother is George")
)

results = await document_search.search("Peppa's brother")

first_result = results[0]

assert isinstance(first_result, TextElement)
assert first_result.content == "Name of Peppa's brother is George"


async def test_document_search_from_config():
@pytest.mark.parametrize(
"document",
[
DocumentMeta.create_text_document_from_literal("Name of Peppa's brother is George"),
],
)
async def test_document_search_from_config(document):
document_search = DocumentSearch.from_config(CONFIG)

await document_search.ingest_document(
DocumentMeta.create_text_document_from_literal("Name of Peppa's brother is George")
)
await document_search.ingest_document(document, document_processor=DummyProvider())
results = await document_search.search("Peppa's brother")

first_result = results[0]
Expand Down

0 comments on commit 227fddc

Please sign in to comment.