@@ -74,17 +74,26 @@ def test_chat_table(engine: Any) -> None:
74
74
)
75
75
76
76
77
- @pytest .mark .asyncio
78
- async def test_chat_schema (engine : Any ) -> None :
79
- doc_table_name = "test_table" + str (uuid .uuid4 ())
80
- engine .init_document_table (table_name = doc_table_name )
77
+ async def test_incorrect_schema_async (async_engine : PGEngine ) -> None :
78
+ table_name = "incorrect_schema_" + str (uuid .uuid4 ())
79
+ await async_engine .ainit_vectorstore_table (table_name = table_name , vector_size = 1024 )
81
80
with pytest .raises (IndexError ):
82
- PGChatMessageHistory .create_sync (
83
- engine = engine , session_id = "test" , table_name = doc_table_name
81
+ await PGChatMessageHistory .create (
82
+ engine = async_engine , session_id = "test" , table_name = table_name
84
83
)
84
+ query = f'DROP TABLE IF EXISTS "{ table_name } "'
85
+ await aexecute (async_engine , query )
85
86
86
- query = f'DROP TABLE IF EXISTS "{ doc_table_name } "'
87
- await aexecute (engine , query )
87
+
88
+ async def test_incorrect_schema_sync (async_engine : PGEngine ) -> None :
89
+ table_name = "incorrect_schema_" + str (uuid .uuid4 ())
90
+ async_engine .init_vectorstore_table (table_name = table_name , vector_size = 1024 )
91
+ with pytest .raises (IndexError ):
92
+ PGChatMessageHistory .create_sync (
93
+ engine = async_engine , session_id = "test" , table_name = table_name
94
+ )
95
+ query = f'DROP TABLE IF EXISTS "{ table_name } "'
96
+ await aexecute (async_engine , query )
88
97
89
98
90
99
@pytest .mark .asyncio
0 commit comments