diff --git a/tests/unit/test_record.py b/tests/unit/test_data_class.py similarity index 97% rename from tests/unit/test_record.py rename to tests/unit/test_data_class.py index 7d1adb4de..83ee12bd0 100644 --- a/tests/unit/test_record.py +++ b/tests/unit/test_data_class.py @@ -1,5 +1,5 @@ +import pytest from langchain_core.documents import Document - from langflow.schema import Data @@ -57,7 +57,8 @@ def test_custom_attribute_get_set_del(): record.custom_attr = "custom_value" assert record.custom_attr == "custom_value" del record.custom_attr - assert record.custom_attr == record.default_value + with pytest.raises(AttributeError): + _ = record.custom_attr def test_deep_copy(): diff --git a/tests/unit/test_initial_setup.py b/tests/unit/test_initial_setup.py index dfce6e2c6..8bfb3d5df 100644 --- a/tests/unit/test_initial_setup.py +++ b/tests/unit/test_initial_setup.py @@ -4,12 +4,7 @@ from pathlib import Path import pytest from sqlmodel import select -from langflow.initial_setup.setup import ( - STARTER_FOLDER_NAME, - create_or_update_starter_projects, - get_project_data, - load_starter_projects, -) +from langflow.initial_setup.setup import STARTER_FOLDER_NAME, get_project_data, load_starter_projects from langflow.services.database.models.folder.model import Folder from langflow.services.deps import session_scope @@ -43,16 +38,14 @@ def test_get_project_data(): @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: - # Run the function to create or update projects - await create_or_update_starter_projects() - # Get the number of projects returned by load_starter_projects num_projects = len(load_starter_projects()) # Get the number of projects in the database folder = session.exec(select(Folder).where(Folder.name == STARTER_FOLDER_NAME)).first() + assert folder is not None 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