refactor: Rename test_record.py to test_data_class.py and update imports and references accordingly
This commit is contained in:
parent
bcfe399df1
commit
29759f2c3e
2 changed files with 6 additions and 12 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
|
import pytest
|
||||||
from langchain_core.documents import Document
|
from langchain_core.documents import Document
|
||||||
|
|
||||||
from langflow.schema import Data
|
from langflow.schema import Data
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -57,7 +57,8 @@ def test_custom_attribute_get_set_del():
|
||||||
record.custom_attr = "custom_value"
|
record.custom_attr = "custom_value"
|
||||||
assert record.custom_attr == "custom_value"
|
assert record.custom_attr == "custom_value"
|
||||||
del record.custom_attr
|
del record.custom_attr
|
||||||
assert record.custom_attr == record.default_value
|
with pytest.raises(AttributeError):
|
||||||
|
_ = record.custom_attr
|
||||||
|
|
||||||
|
|
||||||
def test_deep_copy():
|
def test_deep_copy():
|
||||||
|
|
@ -4,12 +4,7 @@ from pathlib import Path
|
||||||
import pytest
|
import pytest
|
||||||
from sqlmodel import select
|
from sqlmodel import select
|
||||||
|
|
||||||
from langflow.initial_setup.setup import (
|
from langflow.initial_setup.setup import STARTER_FOLDER_NAME, get_project_data, load_starter_projects
|
||||||
STARTER_FOLDER_NAME,
|
|
||||||
create_or_update_starter_projects,
|
|
||||||
get_project_data,
|
|
||||||
load_starter_projects,
|
|
||||||
)
|
|
||||||
from langflow.services.database.models.folder.model import Folder
|
from langflow.services.database.models.folder.model import Folder
|
||||||
from langflow.services.deps import session_scope
|
from langflow.services.deps import session_scope
|
||||||
|
|
||||||
|
|
@ -43,16 +38,14 @@ def test_get_project_data():
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_create_or_update_starter_projects(client):
|
async def test_create_or_update_starter_projects():
|
||||||
with session_scope() as session:
|
with session_scope() as session:
|
||||||
# Run the function to create or update projects
|
|
||||||
await create_or_update_starter_projects()
|
|
||||||
|
|
||||||
# Get the number of projects returned by load_starter_projects
|
# Get the number of projects returned by load_starter_projects
|
||||||
num_projects = len(load_starter_projects())
|
num_projects = len(load_starter_projects())
|
||||||
|
|
||||||
# Get the number of projects in the database
|
# Get the number of projects in the database
|
||||||
folder = session.exec(select(Folder).where(Folder.name == STARTER_FOLDER_NAME)).first()
|
folder = session.exec(select(Folder).where(Folder.name == STARTER_FOLDER_NAME)).first()
|
||||||
|
assert folder is not None
|
||||||
num_db_projects = len(folder.flows)
|
num_db_projects = len(folder.flows)
|
||||||
|
|
||||||
# Check that the number of projects in the database is the same as the number of projects returned by load_starter_projects
|
# Check that the number of projects in the database is the same as the number of projects returned by load_starter_projects
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue