MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_uuid8

Method test_uuid8

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

Source from the content-addressed store, hash-verified

1078 equal(u.int & 0xffff_ffff, tail)
1079
1080 def test_uuid8(self):
1081 equal = self.assertEqual
1082 u = self.uuid.uuid8()
1083
1084 equal(u.variant, self.uuid.RFC_4122)
1085 equal(u.version, 8)
1086
1087 for (_, hi, mid, lo) in product(
1088 range(10), # repeat 10 times
1089 [None, 0, random.getrandbits(48)],
1090 [None, 0, random.getrandbits(12)],
1091 [None, 0, random.getrandbits(62)],
1092 ):
1093 u = self.uuid.uuid8(hi, mid, lo)
1094 equal(u.variant, self.uuid.RFC_4122)
1095 equal(u.version, 8)
1096 if hi is not None:
1097 equal((u.int >> 80) & 0xffffffffffff, hi)
1098 if mid is not None:
1099 equal((u.int >> 64) & 0xfff, mid)
1100 if lo is not None:
1101 equal(u.int & 0x3fffffffffffffff, lo)
1102
1103 def test_uuid8_uniqueness(self):
1104 # Test that UUIDv8-generated values are unique (up to a negligible

Callers

nothing calls this directly

Calls 1

getrandbitsMethod · 0.45

Tested by

no test coverage detected