Skip to content

Commit

Permalink
Merge branch 'move-end-to-end-test'
Browse files Browse the repository at this point in the history
* move-end-to-end-test:
  move index tests into test_index.py
  move llama_stores/
  skip test_query
  move test_query.py into tests/unit/
  • Loading branch information
Quantisan committed Sep 26, 2023
2 parents 47c6a0d + 9ffa00b commit 40fa52c
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 35 deletions.
35 changes: 0 additions & 35 deletions tests/end_to_end/test_query.py

This file was deleted.

19 changes: 19 additions & 0 deletions tests/unit/test_index.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import pytest

from tests.context import extract, index


def bootstrap_index(xml_dir):
nodes = extract.seed_nodes(xml_dir)
return index.index_nodes(nodes)


@pytest.mark.skip(reason="This test takes a minute to run")
def test_bootstrap_index():
xml_dir = "./resources/xmls/12-pdfs-from-steve-aug-22/"
vector_index = bootstrap_index(xml_dir)
assert vector_index is not None


def persist_index(vector_index):
vector_index.storage_context.persist()
19 changes: 19 additions & 0 deletions tests/unit/test_query.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import llama_index as li
import pytest


@pytest.mark.skip(reason="This cost money to run")
def test_query():
storage_context = li.StorageContext.from_defaults(
persist_dir="./tests/unit/llama_stores/12-pdfs-from-steve-aug-22/"
)
vector_index = li.load_index_from_storage(storage_context)
assert vector_index is not None

# Query
query_engine = vector_index.as_query_engine()
assert query_engine is not None

# TODO:
# response = query_engine.query("What interaction is investigated?")
# assert response.get_response()

0 comments on commit 40fa52c

Please sign in to comment.