Skip to content

Commit 224c18a

Browse files
committed
Simplified test code [skip ci]
1 parent 86331f0 commit 224c18a

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

tests/test_sqlalchemy.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import asyncpg
12
import numpy as np
23
import os
34
from pgvector.sqlalchemy import VECTOR, HALFVEC, BIT, SPARSEVEC, SparseVector, avg, sum
@@ -571,8 +572,6 @@ async def test_halfvec(self, engine):
571572

572573
@pytest.mark.asyncio
573574
async def test_bit(self, engine):
574-
import asyncpg
575-
576575
async_session = async_sessionmaker(engine, expire_on_commit=False)
577576

578577
async with async_session() as session:
@@ -611,13 +610,13 @@ async def test_avg(self, engine):
611610
await engine.dispose()
612611

613612

614-
class TestSqlalchemyAsync2:
613+
@pytest.mark.skipif(sqlalchemy_version == 1, reason='Requires SQLAlchemy 2+')
614+
class TestSqlalchemyAsyncArray:
615615
def setup_method(self):
616616
delete_items()
617617

618618
@pytest.mark.asyncio
619-
@pytest.mark.skipif(sqlalchemy_version == 1, reason='Requires SQLAlchemy 2+')
620-
async def test_psycopg_async_vector_array(self):
619+
async def test_psycopg_vector_array(self):
621620
engine = create_async_engine('postgresql+psycopg://localhost/pgvector_python_test')
622621
async_session = async_sessionmaker(engine, expire_on_commit=False)
623622

@@ -638,7 +637,6 @@ def connect(dbapi_connection, connection_record):
638637
await engine.dispose()
639638

640639
@pytest.mark.asyncio
641-
@pytest.mark.skipif(sqlalchemy_version == 1, reason='Requires SQLAlchemy 2+')
642640
async def test_asyncpg_vector_array(self):
643641
engine = create_async_engine('postgresql+asyncpg://localhost/pgvector_python_test')
644642
async_session = async_sessionmaker(engine, expire_on_commit=False)

0 commit comments

Comments
 (0)