Skip to content

Commit

Permalink
Fix types and remove unused test
Browse files Browse the repository at this point in the history
  • Loading branch information
scosman committed Feb 3, 2025
1 parent 210ef8a commit b99dbbd
Show file tree
Hide file tree
Showing 8 changed files with 561 additions and 348 deletions.
9 changes: 5 additions & 4 deletions app/desktop/studio_server/test_finetune_api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import unittest.mock
from pathlib import Path
from unittest.mock import AsyncMock, Mock

import pytest
Expand Down Expand Up @@ -673,7 +674,7 @@ def test_create_finetune_prompt_builder_error(
@pytest.fixture
def mock_dataset_formatter():
formatter = Mock()
formatter.dump_to_file.return_value = "path/to/dataset.jsonl"
formatter.dump_to_file.return_value = Path("path/to/dataset.jsonl")

with unittest.mock.patch(
"app.desktop.studio_server.finetune_api.DatasetFormatter",
Expand All @@ -693,7 +694,7 @@ def test_download_dataset_jsonl(
# Create a temporary file to simulate the dataset
test_file = tmp_path / "dataset.jsonl"
test_file.write_text('{"test": "data"}')
mock_formatter.dump_to_file.return_value = str(test_file)
mock_formatter.dump_to_file.return_value = test_file

response = client.get(
"/api/download_dataset_jsonl",
Expand All @@ -711,7 +712,7 @@ def test_download_dataset_jsonl(
assert response.headers["Content-Type"] == "application/jsonl"
assert (
response.headers["Content-Disposition"]
== 'attachment; filename="dataset_split1_train_openai_chat_jsonl.jsonl"'
== f'attachment; filename="{test_file.name}"'
)
assert response.content == b'{"test": "data"}'

Expand Down Expand Up @@ -789,7 +790,7 @@ def test_download_dataset_jsonl_with_prompt_builder(
# Create a temporary file to simulate the dataset
test_file = tmp_path / "dataset.jsonl"
test_file.write_text('{"test": "data"}')
mock_formatter.dump_to_file.return_value = str(test_file)
mock_formatter.dump_to_file.return_value = test_file

response = client.get(
"/api/download_dataset_jsonl",
Expand Down
Loading

0 comments on commit b99dbbd

Please sign in to comment.