langflow/src/backend/tests/unit
anovazzi1 1df53a87f4
Fix: update initial graph sort for disconnected graph (#5867)
* refactor: add test for sorting vertices in unconnected graph

Add a new test case to the `test_get_sorted_vertices_with_unconnected_graph` function in the `test_utils.py` file. This test verifies the correct sorting of vertices in an unconnected graph. The test defines a graph structure and checks that the first layer contains the input vertices and the remaining layers contain the rest of the vertices in the correct order.

Refactor the code to improve test coverage and ensure the correctness of the sorting algorithm.

* refactor: improve handling of unconnected vertices in graph sorting

* [autofix.ci] apply automated fixes

* Refactor: Update start_component_id in test_get_sorted_vertices_with_unconnected_graph

The start_component_id parameter in the test_get_sorted_vertices_with_unconnected_graph function was updated to "A" to improve the handling of unconnected vertices in graph sorting.

* Refactor: Improve handling of unconnected vertices in graph sorting

* [autofix.ci] apply automated fixes

* Refactor: Add test_filter_vertices_from_vertex function to test_utils.py

* Refactor: Add error handling for missing graph information in filter_vertices_up_to_vertex and filter_vertices_from_vertex functions

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-01-22 20:27:23 +00:00
..
api feat: loop components handle ui and logic (#5744) 2025-01-21 17:52:28 +00:00
base feat: run flow component with tool mode option to run a flow as a tool (#5518) 2025-01-17 23:12:56 +00:00
components feat: add WikiData Component and depeciates the WikiData API tool component (#5872) 2025-01-22 18:30:01 +00:00
custom feat: run flow component with tool mode option to run a flow as a tool (#5518) 2025-01-17 23:12:56 +00:00
events ref: Some ruff fixes from preview (#5420) 2024-12-28 21:25:35 +00:00
exceptions ref: Some ruff fixes from preview (#5420) 2024-12-28 21:25:35 +00:00
graph Fix: update initial graph sort for disconnected graph (#5867) 2025-01-22 20:27:23 +00:00
helpers fix: resolve data keyword conflict in template formatting (#5483) 2024-12-31 13:13:31 +00:00
initial_setup feat: Bump ruff version to 0.9 (#5666) 2025-01-15 15:14:43 +00:00
inputs fix: pass slider input values correctly, add test (#5735) 2025-01-16 18:41:17 +00:00
io ref: Some ruff fixes from preview (#5420) 2024-12-28 21:25:35 +00:00
schema ref: Some ruff fixes from preview (#5420) 2024-12-28 21:25:35 +00:00
services feat: implement function to truncate json (#5811) 2025-01-20 21:15:07 +00:00
utils ref: Some ruff fixes from preview (#5420) 2024-12-28 21:25:35 +00:00
__init__.py refactor: move tests folder structure and update pytest commands (#2785) 2024-07-18 15:19:43 +00:00
mock_language_model.py fix: add default models to Anthropic and make sure template is updated (#5839) 2025-01-21 07:25:47 -08:00
test_api_key.py ref: Add ALL ruff rules for tests (#4183) 2024-10-19 20:41:37 +00:00
test_chat_endpoint.py fix: make chat input sorting logic exclude other components (#5760) 2025-01-20 13:49:44 +00:00
test_cli.py refactor: remove unnecessary 'client' fixture and update test durations (#4283) 2024-10-27 14:16:45 +00:00
test_custom_component.py feat: Implement tool mode functionality and dynamic placeholders across input components (#4402) 2024-11-08 02:31:04 +00:00
test_custom_component_with_client.py ref: Make list_flows async (#5222) 2024-12-12 16:02:43 +00:00
test_data_class.py ref: Some ruff fixes from preview (#5420) 2024-12-28 21:25:35 +00:00
test_database.py ref: Some ruff fixes from preview (#5420) 2024-12-28 21:25:35 +00:00
test_endpoints.py fix: make chat input sorting logic exclude other components (#5760) 2025-01-20 13:49:44 +00:00
test_experimental_components.py ref: Remove autouse from pytest client fixture (#4158) 2024-10-15 22:55:10 +00:00
test_frontend_nodes.py ref: Auto-fix ruff rules in tests (#4154) 2024-10-16 15:42:36 +00:00
test_helper_components.py feat: Refactor langflow Components - Consolidate Imports, Remove Unused Components, and Update Astra Assistant Icons (#4460) 2024-11-11 19:30:05 +00:00
test_initial_setup.py feat: Bump ruff version to 0.9 (#5666) 2025-01-15 15:14:43 +00:00
test_kubernetes_secrets.py ref: Add ALL ruff rules for tests (#4183) 2024-10-19 20:41:37 +00:00
test_loading.py ref: Make load_flow_from_json async (#5057) 2024-12-11 17:53:33 +00:00
test_logger.py ref: Auto-fix ruff rules in tests (#4154) 2024-10-16 15:42:36 +00:00
test_login.py ref: Remove unused sync session_scope, with_session and engine (#5333) 2024-12-18 20:52:06 +00:00
test_messages.py fix: make sure tests run async (#5842) 2025-01-21 08:16:33 -08:00
test_messages_endpoints.py ref: Remove unused sync session_scope, with_session and engine (#5333) 2024-12-18 20:52:06 +00:00
test_process.py ref: Remove some useless asyncio.to_thread (#5149) 2024-12-08 20:13:08 +01:00
test_schema.py feat: loop components handle ui and logic (#5744) 2025-01-21 17:52:28 +00:00
test_setup_superuser.py fix: Use AsyncSession for user management (#4491) 2024-11-16 01:09:33 +00:00
test_telemetry.py ref: Some ruff fixes from preview (#5420) 2024-12-28 21:25:35 +00:00
test_template.py ref: Auto-fix ruff rules in tests (#4154) 2024-10-16 15:42:36 +00:00
test_user.py ref: Make initialize_database async (#5163) 2024-12-10 07:44:34 +01:00
test_validate_code.py feat: Allow variables to be defined outside a Component (#4316) 2024-10-29 06:45:38 -07:00
test_version.py ref: Auto-fix ruff rules in tests (#4154) 2024-10-16 15:42:36 +00:00
test_webhook.py refactor: add graph utility tests and refactor sorting methods (#5538) 2025-01-09 20:15:24 +00:00