Skip to content

Commit 1a5ac19

Browse files
committed
improve UUIDv7 uniqueness tests
1 parent aee2898 commit 1a5ac19

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Lib/test/test_uuid.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -741,9 +741,13 @@ def test_uuid7_uniqueness(self):
741741
# uses os.urandom() as a PRNG which features better randomness.
742742
#
743743
# Until reaching UNIX_EPOCH + 10'000 years, the probability for
744-
# generating two identical UUIDs is negligilbe.
745-
uuids = {self.uuid.uuid7() for _ in range(1000)}
746-
self.assertEqual(len(uuids), 1000)
744+
# generating two identical UUIDs is negligible.
745+
N = 1000
746+
uuids = {self.uuid.uuid7() for _ in range(N)}
747+
self.assertEqual(len(uuids), N)
748+
749+
versions = {u.version for u in uuids}
750+
self.assertSetEqual(versions, {7})
747751

748752
def test_uuid7_monotonicity(self):
749753
equal = self.assertEqual

0 commit comments

Comments
 (0)