Skip to content

Commit b9af75d

Browse files
committed
Adding test cases
1 parent 2b1a039 commit b9af75d

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/test_hash.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,30 @@ def test_numpy_datetime64(self):
208208
later_hash = DeepHash(later)
209209
assert a_hash[a] != later_hash[later]
210210

211+
def test_uuid6_hash_positive(self):
212+
"""Positive test case: Same UUID objects should produce the same hash."""
213+
import uuid6
214+
uuid_obj = uuid6.uuid7()
215+
hash1 = DeepHash(uuid_obj)
216+
hash2 = DeepHash(uuid_obj)
217+
assert hash1[uuid_obj] == hash2[uuid_obj]
218+
219+
import uuid
220+
regular_uuid = uuid.uuid4()
221+
hash_regular = DeepHash(regular_uuid)
222+
assert hash_regular[regular_uuid] is not unprocessed
223+
224+
def test_uuid6_deepdiff_negative(self):
225+
"""Negative test case: DeepDiff should detect differences between sets containing different UUID objects."""
226+
import uuid6
227+
dummy_id_1 = uuid6.uuid7()
228+
dummy_id_2 = uuid6.uuid7()
229+
set1 = {dummy_id_1}
230+
set2 = {dummy_id_1, dummy_id_2}
231+
diff = DeepDiff(set1, set2)
232+
assert diff != {}
233+
assert 'set_item_added' in diff
234+
assert str(dummy_id_2) in str(diff)
211235

212236
class TestDeepHashPrep:
213237
"""DeepHashPrep Tests covering object serialization."""

0 commit comments

Comments
 (0)