MCPcopy Index your code
hub / github.com/python/cpython / test_uuid7_uniqueness

Method test_uuid7_uniqueness

Lib/test/test_uuid.py:930–941  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

928 equal(u.int & 0xffff_ffff, tail)
929
930 def test_uuid7_uniqueness(self):
931 # Test that UUIDv7-generated values are unique.
932 #
933 # While UUIDv8 has an entropy of 122 bits, those 122 bits may not
934 # necessarily be sampled from a PRNG. On the other hand, UUIDv7
935 # uses os.urandom() as a PRNG which features better randomness.
936 N = 1000
937 uuids = {self.uuid.uuid7() for _ in range(N)}
938 self.assertEqual(len(uuids), N)
939
940 versions = {u.version for u in uuids}
941 self.assertSetEqual(versions, {7})
942
943 def test_uuid7_monotonicity(self):
944 equal = self.assertEqual

Callers

nothing calls this directly

Calls 2

assertSetEqualMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected