From de31904097e6fe2b3764cf470befd6049be61f27 Mon Sep 17 00:00:00 2001
From: Pierre-Yves David <pierre-yves.david@ens-lyon.org>
Date: Fri, 24 May 2024 17:19:22 +0200
Subject: [PATCH] enum-cleanup: stop using string value in
 `test_todict_inverse_fromdict`

We also take this as an opportunity to use the blacklist_types feature
in that test.
---
 swh/model/tests/test_model.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/swh/model/tests/test_model.py b/swh/model/tests/test_model.py
index b3bbb365..381e6fa3 100644
--- a/swh/model/tests/test_model.py
+++ b/swh/model/tests/test_model.py
@@ -32,6 +32,7 @@ from swh.model.model import (
     MetadataAuthorityType,
     MetadataFetcher,
     MissingData,
+    ModelObjectType,
     Origin,
     OriginVisit,
     OriginVisitStatus,
@@ -63,13 +64,18 @@ from swh.model.tests.test_identifiers import (
 EXAMPLE_HASH = hash_to_bytes("94a9ed024d3859793618152ea559a168bbcbb5e2")
 
 
-@given(strategies.objects())
+@given(
+    strategies.objects(
+        blacklist_types={
+            ModelObjectType.ORIGIN,
+            ModelObjectType.ORIGIN_VISIT,
+            ModelObjectType.ORIGIN_VISIT_STATUS,
+        }
+    )
+)
 def test_todict_inverse_fromdict(objtype_and_obj):
     (obj_type, obj) = objtype_and_obj
 
-    if obj_type in ("origin", "origin_visit"):
-        return
-
     obj_as_dict = obj.to_dict()
     obj_as_dict_copy = copy.deepcopy(obj_as_dict)
 
-- 
GitLab