From 1168675426f4a122c0a0c037aef5480838d1d49c Mon Sep 17 00:00:00 2001
From: Erwan Rouchet <rouchet@teklia.com>
Date: Wed, 10 Apr 2024 14:40:13 +0200
Subject: [PATCH] Update error messages

---
 arkindex/training/serializers.py             | 6 +++---
 arkindex/training/tests/test_datasets_api.py | 8 ++++----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arkindex/training/serializers.py b/arkindex/training/serializers.py
index 901b94b6d2..048dcecf63 100644
--- a/arkindex/training/serializers.py
+++ b/arkindex/training/serializers.py
@@ -588,7 +588,7 @@ class DatasetSerializer(serializers.ModelSerializer):
             .filter(dupes__gte=2)
             .exists()
         ):
-            raise ValidationError("Elements are currently contained by multiple sets.")
+            raise ValidationError("Some elements are currently contained by multiple sets.")
         return unique
 
     def validate(self, data):
@@ -728,7 +728,7 @@ class DatasetElementSerializer(serializers.ModelSerializer):
             )
         ):
             raise ValidationError([
-                f"The dataset prevent duplication and this element is already present in set {existing_set}."
+                f"The dataset requires unique elements and this element is already present in set {existing_set}."
             ])
         return element
 
@@ -803,7 +803,7 @@ class SelectionDatasetElementSerializer(serializers.Serializer):
             )
         ):
             raise ValidationError([
-                f"The dataset prevent duplication and some elements are already present in set {existing_set}."
+                f"The dataset requires unique elements and some elements are already present in set {existing_set}."
             ])
         return set
 
diff --git a/arkindex/training/tests/test_datasets_api.py b/arkindex/training/tests/test_datasets_api.py
index 58ab00fd83..1dc9beda71 100644
--- a/arkindex/training/tests/test_datasets_api.py
+++ b/arkindex/training/tests/test_datasets_api.py
@@ -613,7 +613,7 @@ class TestDatasetsAPI(FixtureAPITestCase):
             )
             self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
         self.assertDictEqual(response.json(), {
-            "unique_elements": ["Elements are currently contained by multiple sets."]
+            "unique_elements": ["Some elements are currently contained by multiple sets."]
         })
 
     def test_update_state_requires_ponos_auth(self):
@@ -865,7 +865,7 @@ class TestDatasetsAPI(FixtureAPITestCase):
             )
             self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
         self.assertDictEqual(response.json(), {
-            "unique_elements": ["Elements are currently contained by multiple sets."]
+            "unique_elements": ["Some elements are currently contained by multiple sets."]
         })
 
     def test_partial_update_requires_ponos_auth(self):
@@ -1585,7 +1585,7 @@ class TestDatasetsAPI(FixtureAPITestCase):
             )
             self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
         self.assertDictEqual(response.json(), {
-            "element_id": ["The dataset prevent duplication and this element is already present in set training."]
+            "element_id": ["The dataset requires unique elements and this element is already present in set training."]
         })
 
     def test_add_element_allow_dupes(self):
@@ -1761,7 +1761,7 @@ class TestDatasetsAPI(FixtureAPITestCase):
             )
             self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
         self.assertDictEqual(response.json(), {
-            "set_id": ["The dataset prevent duplication and some elements are already present in set training."]
+            "set_id": ["The dataset requires unique elements and some elements are already present in set training."]
         })
 
     def test_add_from_selection_allow_dupes(self):
-- 
GitLab