Skip to content

Commit f026755

Browse files
committed
Remove some rules escapes
1 parent 460bf30 commit f026755

File tree

10 files changed

+129
-146
lines changed

10 files changed

+129
-146
lines changed

libs/astradb/tests/integration_tests/conftest.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -224,14 +224,14 @@ def empty_collection_d2(
224224

225225
@pytest.fixture
226226
def vector_store_d2(
227-
empty_collection_d2: Collection, # noqa: ARG001
227+
empty_collection_d2: Collection,
228228
astra_db_credentials: AstraDBCredentials,
229229
embedding_d2: Embeddings,
230230
) -> AstraDBVectorStore:
231231
"""A fresh vector store on a d=2(Euclidean) collection."""
232232
return AstraDBVectorStore(
233233
embedding=embedding_d2,
234-
collection_name=COLLECTION_NAME_D2,
234+
collection_name=empty_collection_d2.name,
235235
token=StaticTokenProvider(astra_db_credentials["token"]),
236236
api_endpoint=astra_db_credentials["api_endpoint"],
237237
namespace=astra_db_credentials["namespace"],
@@ -242,7 +242,7 @@ def vector_store_d2(
242242

243243
@pytest.fixture
244244
def vector_store_d2_stringtoken(
245-
empty_collection_d2: Collection, # noqa: ARG001
245+
empty_collection_d2: Collection,
246246
astra_db_credentials: AstraDBCredentials,
247247
embedding_d2: Embeddings,
248248
) -> AstraDBVectorStore:
@@ -252,7 +252,7 @@ def vector_store_d2_stringtoken(
252252
"""
253253
return AstraDBVectorStore(
254254
embedding=embedding_d2,
255-
collection_name=COLLECTION_NAME_D2,
255+
collection_name=empty_collection_d2.name,
256256
token=astra_db_credentials["token"],
257257
api_endpoint=astra_db_credentials["api_endpoint"],
258258
namespace=astra_db_credentials["namespace"],
@@ -356,14 +356,14 @@ def empty_collection_idxall_d2(
356356

357357
@pytest.fixture
358358
def vector_store_idxall_d2(
359-
empty_collection_idxall_d2: Collection, # noqa: ARG001
359+
empty_collection_idxall_d2: Collection,
360360
astra_db_credentials: AstraDBCredentials,
361361
embedding_d2: Embeddings,
362362
) -> AstraDBVectorStore:
363363
"""A fresh vector store on a d=2(Euclidean) collection."""
364364
return AstraDBVectorStore(
365365
embedding=embedding_d2,
366-
collection_name=COLLECTION_NAME_IDXALL_D2,
366+
collection_name=empty_collection_idxall_d2.name,
367367
token=StaticTokenProvider(astra_db_credentials["token"]),
368368
api_endpoint=astra_db_credentials["api_endpoint"],
369369
namespace=astra_db_credentials["namespace"],
@@ -421,11 +421,11 @@ def empty_collection_vz(
421421
def vector_store_vz(
422422
astra_db_credentials: AstraDBCredentials,
423423
openai_api_key: str,
424-
empty_collection_vz: Collection, # noqa: ARG001
424+
empty_collection_vz: Collection,
425425
) -> AstraDBVectorStore:
426426
"""A fresh vector store on a $vectorize collection."""
427427
return AstraDBVectorStore(
428-
collection_name=COLLECTION_NAME_VZ,
428+
collection_name=empty_collection_vz.name,
429429
token=StaticTokenProvider(astra_db_credentials["token"]),
430430
api_endpoint=astra_db_credentials["api_endpoint"],
431431
namespace=astra_db_credentials["namespace"],
@@ -488,12 +488,12 @@ def empty_collection_idxall_vz(
488488
@pytest.fixture
489489
def vector_store_idxall_vz(
490490
openai_api_key: str,
491-
empty_collection_idxall_vz: Collection, # noqa: ARG001
491+
empty_collection_idxall_vz: Collection,
492492
astra_db_credentials: AstraDBCredentials,
493493
) -> AstraDBVectorStore:
494494
"""A fresh vector store on a d=2(Euclidean) collection."""
495495
return AstraDBVectorStore(
496-
collection_name=COLLECTION_NAME_IDXALL_VZ,
496+
collection_name=empty_collection_idxall_vz.name,
497497
token=StaticTokenProvider(astra_db_credentials["token"]),
498498
api_endpoint=astra_db_credentials["api_endpoint"],
499499
namespace=astra_db_credentials["namespace"],

libs/astradb/tests/integration_tests/test_cache.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from langchain_astradb.utils.astradb import SetupMode
1313

1414
from .conftest import (
15-
COLLECTION_NAME_IDXALL,
1615
AstraDBCredentials,
1716
astra_db_env_vars_available,
1817
)
@@ -27,10 +26,10 @@
2726
@pytest.fixture
2827
def astradb_cache(
2928
astra_db_credentials: AstraDBCredentials,
30-
empty_collection_idxall: Collection, # noqa: ARG001
29+
empty_collection_idxall: Collection,
3130
) -> AstraDBCache:
3231
return AstraDBCache(
33-
collection_name=COLLECTION_NAME_IDXALL,
32+
collection_name=empty_collection_idxall.name,
3433
token=StaticTokenProvider(astra_db_credentials["token"]),
3534
api_endpoint=astra_db_credentials["api_endpoint"],
3635
namespace=astra_db_credentials["namespace"],
@@ -41,10 +40,10 @@ def astradb_cache(
4140
@pytest.fixture
4241
async def astradb_cache_async(
4342
astra_db_credentials: AstraDBCredentials,
44-
empty_collection_idxall: Collection, # noqa: ARG001
43+
empty_collection_idxall: Collection,
4544
) -> AstraDBCache:
4645
return AstraDBCache(
47-
collection_name=COLLECTION_NAME_IDXALL,
46+
collection_name=empty_collection_idxall.name,
4847
token=StaticTokenProvider(astra_db_credentials["token"]),
4948
api_endpoint=astra_db_credentials["api_endpoint"],
5049
namespace=astra_db_credentials["namespace"],
@@ -191,7 +190,7 @@ def test_cache_coreclients_init_sync(
191190
# create an equivalent cache with core AstraDB in init
192191
with pytest.warns(DeprecationWarning) as rec_warnings:
193192
cache_init_core = AstraDBCache(
194-
collection_name=COLLECTION_NAME_IDXALL,
193+
collection_name=astradb_cache.collection.name,
195194
astra_db_client=core_astra_db,
196195
)
197196
f_rec_warnings = [
@@ -218,7 +217,7 @@ async def test_cache_coreclients_init_async(
218217
# create an equivalent cache with core AstraDB in init
219218
with pytest.warns(DeprecationWarning) as rec_warnings:
220219
cache_init_core = AstraDBCache(
221-
collection_name=COLLECTION_NAME_IDXALL,
220+
collection_name=astradb_cache_async.async_collection.name,
222221
astra_db_client=core_astra_db,
223222
setup_mode=SetupMode.ASYNC,
224223
)

libs/astradb/tests/integration_tests/test_chat_message_histories.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from langchain_astradb.utils.astradb import SetupMode
1313

1414
from .conftest import (
15-
COLLECTION_NAME_IDXALL,
1615
AstraDBCredentials,
1716
astra_db_env_vars_available,
1817
)
@@ -21,11 +20,11 @@
2120
@pytest.fixture
2221
def history1(
2322
astra_db_credentials: AstraDBCredentials,
24-
empty_collection_idxall: Collection, # noqa: ARG001
23+
empty_collection_idxall: Collection,
2524
) -> AstraDBChatMessageHistory:
2625
return AstraDBChatMessageHistory(
2726
session_id="session-test-1",
28-
collection_name=COLLECTION_NAME_IDXALL,
27+
collection_name=empty_collection_idxall.name,
2928
token=astra_db_credentials["token"],
3029
api_endpoint=astra_db_credentials["api_endpoint"],
3130
namespace=astra_db_credentials["namespace"],
@@ -36,11 +35,11 @@ def history1(
3635
@pytest.fixture
3736
def history2(
3837
astra_db_credentials: AstraDBCredentials,
39-
history1: AstraDBChatMessageHistory, # noqa: ARG001
38+
history1: AstraDBChatMessageHistory,
4039
) -> AstraDBChatMessageHistory:
4140
return AstraDBChatMessageHistory(
4241
session_id="session-test-2",
43-
collection_name=COLLECTION_NAME_IDXALL,
42+
collection_name=history1.collection_name,
4443
token=astra_db_credentials["token"],
4544
api_endpoint=astra_db_credentials["api_endpoint"],
4645
namespace=astra_db_credentials["namespace"],
@@ -54,11 +53,11 @@ def history2(
5453
@pytest.fixture
5554
async def async_history1(
5655
astra_db_credentials: AstraDBCredentials,
57-
history1: AstraDBChatMessageHistory, # noqa: ARG001
56+
history1: AstraDBChatMessageHistory,
5857
) -> AstraDBChatMessageHistory:
5958
return AstraDBChatMessageHistory(
6059
session_id="async-session-test-1",
61-
collection_name=COLLECTION_NAME_IDXALL,
60+
collection_name=history1.collection_name,
6261
token=astra_db_credentials["token"],
6362
api_endpoint=astra_db_credentials["api_endpoint"],
6463
namespace=astra_db_credentials["namespace"],
@@ -70,11 +69,11 @@ async def async_history1(
7069
@pytest.fixture
7170
async def async_history2(
7271
astra_db_credentials: AstraDBCredentials,
73-
history1: AstraDBChatMessageHistory, # noqa: ARG001
72+
history1: AstraDBChatMessageHistory,
7473
) -> AstraDBChatMessageHistory:
7574
return AstraDBChatMessageHistory(
7675
session_id="async-session-test-2",
77-
collection_name=COLLECTION_NAME_IDXALL,
76+
collection_name=history1.collection_name,
7877
token=astra_db_credentials["token"],
7978
api_endpoint=astra_db_credentials["api_endpoint"],
8079
namespace=astra_db_credentials["namespace"],
@@ -208,13 +207,13 @@ def test_chatmsh_coreclients_init_sync(
208207
self,
209208
astra_db_credentials: AstraDBCredentials,
210209
core_astra_db: AstraDB,
211-
empty_collection_idxall: Collection, # noqa: ARG002
210+
empty_collection_idxall: Collection,
212211
) -> None:
213212
"""A deprecation warning from passing a (core) AstraDB, but it works."""
214213
test_messages = [AIMessage(content="Meow.")]
215214
chatmh_init_ok = AstraDBChatMessageHistory(
216215
session_id="gattini",
217-
collection_name=COLLECTION_NAME_IDXALL,
216+
collection_name=empty_collection_idxall.name,
218217
token=astra_db_credentials["token"],
219218
api_endpoint=astra_db_credentials["api_endpoint"],
220219
namespace=astra_db_credentials["namespace"],
@@ -224,7 +223,7 @@ def test_chatmsh_coreclients_init_sync(
224223
# create an equivalent cache with core AstraDB in init
225224
with pytest.warns(DeprecationWarning) as rec_warnings:
226225
chatmh_init_core = AstraDBChatMessageHistory(
227-
collection_name=COLLECTION_NAME_IDXALL,
226+
collection_name=empty_collection_idxall.name,
228227
session_id="gattini",
229228
astra_db_client=core_astra_db,
230229
)
@@ -242,13 +241,13 @@ async def test_chatmsh_coreclients_init_async(
242241
self,
243242
astra_db_credentials: AstraDBCredentials,
244243
core_astra_db: AstraDB,
245-
empty_collection_idxall: Collection, # noqa: ARG002
244+
empty_collection_idxall: Collection,
246245
) -> None:
247246
"""A deprecation warning from passing a (core) AstraDB, but it works."""
248247
test_messages = [AIMessage(content="Ameow.")]
249248
chatmh_init_ok = AstraDBChatMessageHistory(
250249
session_id="gattini",
251-
collection_name=COLLECTION_NAME_IDXALL,
250+
collection_name=empty_collection_idxall.name,
252251
token=astra_db_credentials["token"],
253252
api_endpoint=astra_db_credentials["api_endpoint"],
254253
namespace=astra_db_credentials["namespace"],
@@ -258,7 +257,7 @@ async def test_chatmsh_coreclients_init_async(
258257
# create an equivalent cache with core AstraDB in init
259258
with pytest.warns(DeprecationWarning) as rec_warnings:
260259
chatmh_init_core = AstraDBChatMessageHistory(
261-
collection_name=COLLECTION_NAME_IDXALL,
260+
collection_name=empty_collection_idxall.name,
262261
session_id="gattini",
263262
astra_db_client=core_astra_db,
264263
setup_mode=SetupMode.ASYNC,

0 commit comments

Comments
 (0)