test: add astra integration test (#2189)
* add first astra integ test framework * use fixtures * remove old tests from merge * Add correct sender type * chore: Update unit test command in GitHub workflow --------- Co-authored-by: ogabrielluiz <gabriel@langflow.org>
This commit is contained in:
parent
5a04adfa1f
commit
ca660cf8df
31 changed files with 211 additions and 12 deletions
35
tests/integration/utils.py
Normal file
35
tests/integration/utils.py
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import os
|
||||
from typing import List
|
||||
|
||||
from langflow.field_typing import Embeddings, VectorStore
|
||||
|
||||
|
||||
def check_env_vars(*vars):
|
||||
"""
|
||||
Check if all specified environment variables are set.
|
||||
|
||||
Args:
|
||||
*vars (str): The environment variables to check.
|
||||
|
||||
Returns:
|
||||
bool: True if all environment variables are set, False otherwise.
|
||||
"""
|
||||
return all(os.getenv(var) for var in vars)
|
||||
|
||||
|
||||
class MockEmbeddings(Embeddings):
|
||||
def __init__(self):
|
||||
self.embedded_documents = None
|
||||
self.embedded_query = None
|
||||
|
||||
@staticmethod
|
||||
def mock_embedding(text: str):
|
||||
return [len(text) / 2, len(text) / 5, len(text) / 10]
|
||||
|
||||
def embed_documents(self, texts: List[str]) -> List[List[float]]:
|
||||
self.embedded_documents = texts
|
||||
return [self.mock_embedding(text) for text in texts]
|
||||
|
||||
def embed_query(self, text: str) -> List[float]:
|
||||
self.embedded_query = text
|
||||
return self.mock_embedding(text)
|
||||
Loading…
Add table
Add a link
Reference in a new issue