@@ -107,7 +107,7 @@ async def test_node_name_and_exception_post_llm(
107107
108108 # Verify node returns empty dict
109109 with caplog .at_level (logging .INFO ):
110- result = await node (
110+ await node (
111111 AgentGuardrailsGraphState (
112112 messages = [], guardrail_validation_result = "validation error"
113113 )
@@ -118,9 +118,15 @@ async def test_node_name_and_exception_post_llm(
118118 assert log_record .levelno == logging .INFO
119119
120120 # Verify default message includes all context
121- assert "Guardrail [Test Guardrail] validation failed for [LLM] [POST_EXECUTION]" in log_record .message
121+ assert (
122+ "Guardrail [Test Guardrail] validation failed for [LLM] [POST_EXECUTION]"
123+ in log_record .message
124+ )
122125 assert "validation error" in log_record .message
123- assert log_record .message == "Guardrail [Test Guardrail] validation failed for [LLM] [POST_EXECUTION] with the following reason: validation error"
126+ assert (
127+ log_record .message
128+ == "Guardrail [Test Guardrail] validation failed for [LLM] [POST_EXECUTION] with the following reason: validation error"
129+ )
124130
125131 @pytest .mark .asyncio
126132 async def test_node_name_and_exception_pre_tool (
@@ -147,7 +153,7 @@ async def test_node_name_and_exception_pre_tool(
147153
148154 # Verify node returns empty dict
149155 with caplog .at_level (logging .WARNING ):
150- result = await node (
156+ await node (
151157 AgentGuardrailsGraphState (
152158 messages = [], guardrail_validation_result = "invalid tool args"
153159 )
@@ -158,9 +164,15 @@ async def test_node_name_and_exception_pre_tool(
158164 assert log_record .levelno == logging .WARNING
159165
160166 # Verify default message includes all context
161- assert "Guardrail [Tool Guardrail v2] validation failed for [TOOL] [PRE_EXECUTION]" in log_record .message
167+ assert (
168+ "Guardrail [Tool Guardrail v2] validation failed for [TOOL] [PRE_EXECUTION]"
169+ in log_record .message
170+ )
162171 assert "invalid tool args" in log_record .message
163- assert log_record .message == "Guardrail [Tool Guardrail v2] validation failed for [TOOL] [PRE_EXECUTION] with the following reason: invalid tool args"
172+ assert (
173+ log_record .message
174+ == "Guardrail [Tool Guardrail v2] validation failed for [TOOL] [PRE_EXECUTION] with the following reason: invalid tool args"
175+ )
164176
165177 @pytest .mark .asyncio
166178 async def test_node_name_and_exception_post_tool (
@@ -187,7 +199,7 @@ async def test_node_name_and_exception_post_tool(
187199
188200 # Verify node returns empty dict
189201 with caplog .at_level (logging .ERROR ):
190- result = await node (
202+ await node (
191203 AgentGuardrailsGraphState (
192204 messages = [], guardrail_validation_result = "tool error"
193205 )
@@ -199,8 +211,12 @@ async def test_node_name_and_exception_post_tool(
199211
200212 # Verify custom message was logged (not default message)
201213 assert log_record .message == "Tool execution failed"
202- assert "Guardrail" not in log_record .message # Custom message doesn't include guardrail context
203- assert "validation failed" not in log_record .message # Custom message doesn't include default format
214+ assert (
215+ "Guardrail" not in log_record .message
216+ ) # Custom message doesn't include guardrail context
217+ assert (
218+ "validation failed" not in log_record .message
219+ ) # Custom message doesn't include default format
204220
205221 @pytest .mark .asyncio
206222 async def test_node_name_and_exception_post_tool_warning (
@@ -227,7 +243,7 @@ async def test_node_name_and_exception_post_tool_warning(
227243
228244 # Verify node returns empty dict
229245 with caplog .at_level (logging .WARNING ):
230- result = await node (
246+ await node (
231247 AgentGuardrailsGraphState (
232248 messages = [], guardrail_validation_result = "post execution error"
233249 )
@@ -238,6 +254,12 @@ async def test_node_name_and_exception_post_tool_warning(
238254 assert log_record .levelno == logging .WARNING
239255
240256 # Verify default message includes all context
241- assert "Guardrail [Post Tool Guardrail] validation failed for [TOOL] [POST_EXECUTION]" in log_record .message
257+ assert (
258+ "Guardrail [Post Tool Guardrail] validation failed for [TOOL] [POST_EXECUTION]"
259+ in log_record .message
260+ )
242261 assert "post execution error" in log_record .message
243- assert log_record .message == "Guardrail [Post Tool Guardrail] validation failed for [TOOL] [POST_EXECUTION] with the following reason: post execution error"
262+ assert (
263+ log_record .message
264+ == "Guardrail [Post Tool Guardrail] validation failed for [TOOL] [POST_EXECUTION] with the following reason: post execution error"
265+ )
0 commit comments