Skip to content

Fix Broken Test Case Due to Changed Error Message #1881

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/ragas/dataset_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,9 @@ def validate_samples(self, samples: t.List[Sample]) -> t.List[Sample]:
first_sample_type = type(samples[0])
for i, sample in enumerate(samples):
if not isinstance(sample, first_sample_type):
raise ValueError(f"Sample at index {i} is of type {type(sample)}, expected {first_sample_type}")
raise ValueError(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The extra space here due to make run-ci

f"Sample at index {i} is of type {type(sample)}, expected {first_sample_type}"
)

return samples

Expand Down
8 changes: 7 additions & 1 deletion tests/unit/test_dataset_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,13 @@ def test_single_type_evaluation_dataset(eval_sample):
with pytest.raises(ValueError) as exc_info:
EvaluationDataset(samples=[single_turn_sample, multi_turn_sample])

assert "All samples must be of the same type" in str(exc_info.value)
error_message = str(exc_info.value)

assert (
"Sample at index 1 is of type <class 'ragas.dataset_schema.MultiTurnSample'>"
in error_message
)
assert "expected <class 'ragas.dataset_schema.SingleTurnSample'>" in error_message


def test_base_eval_sample():
Expand Down
Loading