From 362ebf609be87296d173d9c87a17437dbccc09c2 Mon Sep 17 00:00:00 2001
From: Valentin Lorentz <vlorentz@softwareheritage.org>
Date: Tue, 29 Sep 2020 12:48:29 +0200
Subject: [PATCH] Merge the two test_identifiers.py files.

I created one in the wrong directory and didn't see the existing one.
---
 swh/model/test_identifiers.py       | 72 -----------------------------
 swh/model/tests/test_identifiers.py | 66 ++++++++++++++++++++++++++
 2 files changed, 66 insertions(+), 72 deletions(-)
 delete mode 100644 swh/model/test_identifiers.py

diff --git a/swh/model/test_identifiers.py b/swh/model/test_identifiers.py
deleted file mode 100644
index 412e00a0..00000000
--- a/swh/model/test_identifiers.py
+++ /dev/null
@@ -1,72 +0,0 @@
-# Copyright (C) 2020 The Software Heritage developers
-# See the AUTHORS file at the top-level directory of this distribution
-# License: GNU General Public License version 3, or any later version
-# See top-level LICENSE file for more information
-
-from swh.model.identifiers import SWHID
-
-
-def test_swhid_hash():
-    object_id = "94a9ed024d3859793618152ea559a168bbcbb5e2"
-
-    assert hash(SWHID(object_type="directory", object_id=object_id)) == hash(
-        SWHID(object_type="directory", object_id=object_id)
-    )
-
-    assert hash(
-        SWHID(
-            object_type="directory",
-            object_id=object_id,
-            metadata={"foo": "bar", "baz": "qux"},
-        )
-    ) == hash(
-        SWHID(
-            object_type="directory",
-            object_id=object_id,
-            metadata={"foo": "bar", "baz": "qux"},
-        )
-    )
-
-    # Different order of the dictionary, so the underlying order of the tuple in
-    # ImmutableDict is different.
-    assert hash(
-        SWHID(
-            object_type="directory",
-            object_id=object_id,
-            metadata={"foo": "bar", "baz": "qux"},
-        )
-    ) == hash(
-        SWHID(
-            object_type="directory",
-            object_id=object_id,
-            metadata={"baz": "qux", "foo": "bar"},
-        )
-    )
-
-
-def test_swhid_eq():
-    object_id = "94a9ed024d3859793618152ea559a168bbcbb5e2"
-
-    assert SWHID(object_type="directory", object_id=object_id) == SWHID(
-        object_type="directory", object_id=object_id
-    )
-
-    assert SWHID(
-        object_type="directory",
-        object_id=object_id,
-        metadata={"foo": "bar", "baz": "qux"},
-    ) == SWHID(
-        object_type="directory",
-        object_id=object_id,
-        metadata={"foo": "bar", "baz": "qux"},
-    )
-
-    assert SWHID(
-        object_type="directory",
-        object_id=object_id,
-        metadata={"foo": "bar", "baz": "qux"},
-    ) == SWHID(
-        object_type="directory",
-        object_id=object_id,
-        metadata={"baz": "qux", "foo": "bar"},
-    )
diff --git a/swh/model/tests/test_identifiers.py b/swh/model/tests/test_identifiers.py
index 3741b70a..ed34d23d 100644
--- a/swh/model/tests/test_identifiers.py
+++ b/swh/model/tests/test_identifiers.py
@@ -1075,3 +1075,69 @@ TS_DICTS_INVALID_TIMESTAMP = [
 def test_normalize_timestamp_dict_invalid_timestamp(dict_input):
     with pytest.raises(ValueError, match="non-integer timestamp"):
         normalize_timestamp(dict_input)
+
+
+def test_swhid_hash():
+    object_id = "94a9ed024d3859793618152ea559a168bbcbb5e2"
+
+    assert hash(SWHID(object_type="directory", object_id=object_id)) == hash(
+        SWHID(object_type="directory", object_id=object_id)
+    )
+
+    assert hash(
+        SWHID(
+            object_type="directory",
+            object_id=object_id,
+            metadata={"foo": "bar", "baz": "qux"},
+        )
+    ) == hash(
+        SWHID(
+            object_type="directory",
+            object_id=object_id,
+            metadata={"foo": "bar", "baz": "qux"},
+        )
+    )
+
+    # Different order of the dictionary, so the underlying order of the tuple in
+    # ImmutableDict is different.
+    assert hash(
+        SWHID(
+            object_type="directory",
+            object_id=object_id,
+            metadata={"foo": "bar", "baz": "qux"},
+        )
+    ) == hash(
+        SWHID(
+            object_type="directory",
+            object_id=object_id,
+            metadata={"baz": "qux", "foo": "bar"},
+        )
+    )
+
+
+def test_swhid_eq():
+    object_id = "94a9ed024d3859793618152ea559a168bbcbb5e2"
+
+    assert SWHID(object_type="directory", object_id=object_id) == SWHID(
+        object_type="directory", object_id=object_id
+    )
+
+    assert SWHID(
+        object_type="directory",
+        object_id=object_id,
+        metadata={"foo": "bar", "baz": "qux"},
+    ) == SWHID(
+        object_type="directory",
+        object_id=object_id,
+        metadata={"foo": "bar", "baz": "qux"},
+    )
+
+    assert SWHID(
+        object_type="directory",
+        object_id=object_id,
+        metadata={"foo": "bar", "baz": "qux"},
+    ) == SWHID(
+        object_type="directory",
+        object_id=object_id,
+        metadata={"baz": "qux", "foo": "bar"},
+    )
-- 
GitLab