From 1ce52c661698daa728ee0d711f98b4e3c2e60d78 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 1 Oct 2025 17:30:23 +0000 Subject: [PATCH] Fix lint issues in test_flow.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add ValidationError import from pydantic - Use ValidationError instead of generic Exception in test - Remove unused flow variable - Apply ruff formatting (import ordering and getattr simplification) Co-Authored-By: João --- tests/test_flow.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/test_flow.py b/tests/test_flow.py index d63c98b91..1ba229239 100644 --- a/tests/test_flow.py +++ b/tests/test_flow.py @@ -4,17 +4,17 @@ import asyncio from datetime import datetime import pytest -from pydantic import BaseModel +from pydantic import BaseModel, ValidationError -from crewai.flow.flow import Flow, and_, listen, or_, router, start from crewai.events.event_bus import crewai_event_bus from crewai.events.types.flow_events import ( FlowFinishedEvent, - FlowStartedEvent, FlowPlotEvent, + FlowStartedEvent, MethodExecutionFinishedEvent, MethodExecutionStartedEvent, ) +from crewai.flow.flow import Flow, and_, listen, or_, router, start def test_simple_sequential_flow(): @@ -679,11 +679,11 @@ def test_structured_flow_event_emission(): assert isinstance(received_events[3], MethodExecutionStartedEvent) assert received_events[3].method_name == "send_welcome_message" assert received_events[3].params == {} - assert getattr(received_events[3].state, "sent") is False + assert received_events[3].state.sent is False assert isinstance(received_events[4], MethodExecutionFinishedEvent) assert received_events[4].method_name == "send_welcome_message" - assert getattr(received_events[4].state, "sent") is True + assert received_events[4].state.sent is True assert received_events[4].result == "Welcome, Anakin!" assert isinstance(received_events[5], FlowFinishedEvent) @@ -930,8 +930,8 @@ def test_flow_init_with_required_fields_missing_values(): def step_1(self): pass - with pytest.raises(Exception): - flow = RequiredFieldsFlow() + with pytest.raises(ValidationError): + RequiredFieldsFlow() def test_flow_init_with_mixed_required_optional_fields():