@@ -15,12 +15,12 @@ async def setup_connection(self):
1515 conn = await asyncpg .connect (database = 'pgvector_python_test' )
1616 await conn .execute ('CREATE EXTENSION IF NOT EXISTS vector' )
1717 await register_vector (conn )
18- await conn .execute ('DROP TABLE IF EXISTS asyncpg_items' )
1918 return conn
2019
2120 @pytest .mark .asyncio
2221 async def test_vector (self ):
2322 conn = await self .setup_connection ();
23+ await conn .execute ('DROP TABLE IF EXISTS asyncpg_items' )
2424 await conn .execute ('CREATE TABLE asyncpg_items (id bigserial PRIMARY KEY, embedding vector(3))' )
2525
2626 embedding = Vector ([1.5 , 2 , 3 ])
@@ -44,6 +44,7 @@ async def test_vector(self):
4444 @pytest .mark .asyncio
4545 async def test_halfvec (self ):
4646 conn = await self .setup_connection ();
47+ await conn .execute ('DROP TABLE IF EXISTS asyncpg_items' )
4748 await conn .execute ('CREATE TABLE asyncpg_items (id bigserial PRIMARY KEY, embedding halfvec(3))' )
4849
4950 embedding = HalfVector ([1.5 , 2 , 3 ])
@@ -65,6 +66,7 @@ async def test_halfvec(self):
6566 @pytest .mark .asyncio
6667 async def test_bit (self ):
6768 conn = await self .setup_connection ();
69+ await conn .execute ('DROP TABLE IF EXISTS asyncpg_items' )
6870 await conn .execute ('CREATE TABLE asyncpg_items (id bigserial PRIMARY KEY, embedding bit(3))' )
6971
7072 embedding = asyncpg .BitString ('101' ) # type: ignore
@@ -85,6 +87,7 @@ async def test_bit(self):
8587 @pytest .mark .asyncio
8688 async def test_sparsevec (self ):
8789 conn = await self .setup_connection ();
90+ await conn .execute ('DROP TABLE IF EXISTS asyncpg_items' )
8891 await conn .execute ('CREATE TABLE asyncpg_items (id bigserial PRIMARY KEY, embedding sparsevec(3))' )
8992
9093 embedding = SparseVector ([1.5 , 2 , 3 ])
@@ -104,6 +107,7 @@ async def test_sparsevec(self):
104107 @pytest .mark .asyncio
105108 async def test_vector_array (self ):
106109 conn = await self .setup_connection ();
110+ await conn .execute ('DROP TABLE IF EXISTS asyncpg_items' )
107111 await conn .execute ('CREATE TABLE asyncpg_items (id bigserial PRIMARY KEY, embeddings vector[])' )
108112
109113 embeddings = [Vector ([1.5 , 2 , 3 ]), Vector ([4.5 , 5 , 6 ])]
0 commit comments