Skip to content

Commit

Permalink
tests: Add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
frascuchon committed Jun 20, 2024
1 parent 575d746 commit cb05e13
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion argilla/tests/unit/test_resources/test_responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@

import pytest

from argilla import UserResponse, Response
from argilla import Response, Dataset, Settings, TextQuestion, Workspace
from argilla._models import UserResponseModel
from argilla.responses import ResponseStatus, UserResponse
from argilla.users import DELETED_USER


class TestResponses:
Expand Down Expand Up @@ -85,3 +88,13 @@ def test_create_user_response_with_multiple_user_id(self):
Response(question_name="other-question", value="answer", user_id=other_user_id),
],
)

def test_create_user_response_from_model_without_user_id(self):
mock_workspace = Workspace(id=uuid.uuid4(), name="workspace")
dataset = Dataset(settings=Settings(questions=[TextQuestion(name="question")]), workspace=mock_workspace)
response = UserResponse.from_model(
UserResponseModel(values={"question": {"value": "answer"}}, user_id=None, status=ResponseStatus.draft),
dataset=dataset,
)

assert response.user_id == DELETED_USER.id

0 comments on commit cb05e13

Please sign in to comment.