Skip to content

Commit 4e8bfdd

Browse files
committed
fix test
1 parent 493c64a commit 4e8bfdd

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

tests/adapters/test_braintrust_adapter.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import json
21
import os
32
from types import SimpleNamespace
43
from typing import Any, Dict, List
@@ -18,7 +17,7 @@ def __init__(self, json_data: Dict[str, Any], status_code: int = 200):
1817
self.json_data = json_data
1918
self.status_code = status_code
2019

21-
def json(self) -> Dict[str, Any]: # noqa: F811
20+
def json(self) -> Dict[str, Any]:
2221
return self.json_data
2322

2423
def raise_for_status(self) -> None:
@@ -30,7 +29,7 @@ def raise_for_status(self) -> None:
3029
def mock_requests_post(monkeypatch):
3130
"""Mock requests.post to return sample data"""
3231

33-
def fake_post(url: str, headers=None, json_data=None):
32+
def fake_post(url: str, headers=None, json=None):
3433
# Return a simplified response for basic tests
3534
return MockResponse(
3635
{
@@ -66,7 +65,7 @@ def test_basic_btql_query_returns_evaluation_rows(mock_requests_post):
6665
def test_trace_with_tool_calls_preserved(monkeypatch):
6766
"""Test that tool calls are properly preserved in converted messages"""
6867

69-
def mock_post(url: str, headers=None, json_data=None):
68+
def mock_post(url: str, headers=None, json=None):
7069
return MockResponse(
7170
{
7271
"data": [
@@ -118,7 +117,7 @@ def mock_post(url: str, headers=None, json_data=None):
118117
def test_trace_with_tool_response_messages(monkeypatch):
119118
"""Test that tool response messages are properly handled"""
120119

121-
def mock_post(url: str, headers=None, json_data=None):
120+
def mock_post(url: str, headers=None, json=None):
122121
return MockResponse(
123122
{
124123
"data": [
@@ -179,7 +178,7 @@ def mock_post(url: str, headers=None, json_data=None):
179178
def test_tools_extracted_from_metadata_variants(monkeypatch):
180179
"""Test that tools are extracted from different metadata locations"""
181180

182-
def mock_post_with_tools_in_metadata(url: str, headers=None, json_data=None):
181+
def mock_post_with_tools_in_metadata(url: str, headers=None, json=None):
183182
return MockResponse(
184183
{
185184
"data": [
@@ -214,7 +213,7 @@ def mock_post_with_tools_in_metadata(url: str, headers=None, json_data=None):
214213
def test_tools_extracted_from_hidden_params(monkeypatch):
215214
"""Test that tools are extracted from nested hidden_params location"""
216215

217-
def mock_post_with_hidden_tools(url: str, headers=None, json_data=None):
216+
def mock_post_with_hidden_tools(url: str, headers=None, json=None):
218217
return MockResponse(
219218
{
220219
"data": [
@@ -256,7 +255,7 @@ def mock_post_with_hidden_tools(url: str, headers=None, json_data=None):
256255
def test_empty_btql_response_returns_empty_list(monkeypatch):
257256
"""Test that empty BTQL response returns empty list"""
258257

259-
def mock_empty_post(url: str, headers=None, json_data=None):
258+
def mock_empty_post(url: str, headers=None, json=None):
260259
return MockResponse({"data": []})
261260

262261
monkeypatch.setattr("requests.post", mock_empty_post)
@@ -270,7 +269,7 @@ def mock_empty_post(url: str, headers=None, json_data=None):
270269
def test_trace_without_meaningful_conversation_skipped(monkeypatch):
271270
"""Test that traces without input or output are skipped"""
272271

273-
def mock_post_incomplete_trace(url: str, headers=None, json_data=None):
272+
def mock_post_incomplete_trace(url: str, headers=None, json=None):
274273
return MockResponse(
275274
{
276275
"data": [
@@ -299,7 +298,7 @@ def mock_post_incomplete_trace(url: str, headers=None, json_data=None):
299298
def test_custom_converter_used_when_provided(monkeypatch):
300299
"""Test that custom converter is used when provided"""
301300

302-
def mock_post(url: str, headers=None, json_data=None):
301+
def mock_post(url: str, headers=None, json=None):
303302
return MockResponse(
304303
{
305304
"data": [
@@ -337,7 +336,7 @@ def custom_converter(trace: Dict[str, Any], include_tool_calls: bool):
337336
def test_api_authentication_error_handling(monkeypatch):
338337
"""Test that API authentication errors are handled properly"""
339338

340-
def mock_auth_error(url: str, headers=None, json_data=None):
339+
def mock_auth_error(url: str, headers=None, json=None):
341340
return MockResponse({}, status_code=401)
342341

343342
monkeypatch.setattr("requests.post", mock_auth_error)

0 commit comments

Comments
 (0)