mirror of
https://github.com/lancedb/lancedb.git
synced 2026-11-28 05:24:00 +00:00
test(python): expand minimal dependency coverage
Expand the Linux Python test run without pandas and pylance from two files to the suite while retaining the regular dependency run for optional-package modules. Move optional imports into tests that need them and use Arrow assertions where pandas is not required, preserving the existing behavioral assertions. Validation: - Physical no-pandas/no-pylance broad run: 2884 passed, 316 skipped, 8 existing marker cases deselected. - Regular affected suite: 1687 passed, 39 skipped. - Current-head hosted integration: all 15 checks and 4 workflows passed. Co-authored-by: importcpp <57519936+importcpp@users.noreply.github.com>
This commit is contained in:
@@ -39,7 +39,6 @@ from lancedb.query import (
|
||||
)
|
||||
import numpy as np
|
||||
import pyarrow as pa
|
||||
import pandas as pd
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
from utils import exception_output
|
||||
@@ -154,7 +153,7 @@ def table(tmp_path) -> ldb.table.LanceTable:
|
||||
count = [local_random.randint(1, 10000) for _ in range(100)]
|
||||
table = db.create_table(
|
||||
"test",
|
||||
data=pd.DataFrame(
|
||||
data=pa.table(
|
||||
{
|
||||
"vector": vectors,
|
||||
"id": [i % 2 for i in range(100)],
|
||||
@@ -239,7 +238,7 @@ async def async_table(tmp_path) -> ldb.table.AsyncTable:
|
||||
count = [local_random.randint(1, 10000) for _ in range(100)]
|
||||
table = await db.create_table(
|
||||
"test",
|
||||
data=pd.DataFrame(
|
||||
data=pa.table(
|
||||
{
|
||||
"vector": vectors,
|
||||
"id": [i % 2 for i in range(100)],
|
||||
@@ -760,9 +759,9 @@ def test_search_order_by_ascending(table):
|
||||
|
||||
def test_create_index_from_table(tmp_path, table):
|
||||
table.create_fts_index("text")
|
||||
df = table.search("puppy").limit(5).select(["text"]).to_pandas()
|
||||
assert len(df) <= 5
|
||||
assert "text" in df.columns
|
||||
result = table.search("puppy").limit(5).select(["text"]).to_arrow()
|
||||
assert len(result) <= 5
|
||||
assert "text" in result.column_names
|
||||
|
||||
# Check whether it can be updated
|
||||
table.add(
|
||||
@@ -782,7 +781,7 @@ def test_create_index_from_table(tmp_path, table):
|
||||
table.create_fts_index("text")
|
||||
|
||||
table.create_fts_index("text", replace=True)
|
||||
assert len(table.search("gorilla").limit(1).to_pandas()) == 1
|
||||
assert len(table.search("gorilla").limit(1).to_arrow()) == 1
|
||||
|
||||
|
||||
def test_create_index_multiple_columns(tmp_path, table):
|
||||
|
||||
Reference in New Issue
Block a user