Skip to content

Commit ecf263a

Browse files
committed
Add comments to test assertions
1 parent 2fde894 commit ecf263a

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

Lib/test/test_uuid.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,17 @@ def test_nil_uuid(self):
4343
self.assertEqual(nil_uuid, self.uuid.UUID(int=i))
4444
self.assertEqual(nil_uuid.int, i)
4545
self.assertEqual(str(nil_uuid), s)
46-
self.assertIsNone(nil_uuid.version)
46+
# The Nil UUID falls within the range of the Apollo NCS variant as per
47+
# RFC 9562.
48+
# See https://www.rfc-editor.org/rfc/rfc9562.html#table1
49+
# See https://www.rfc-editor.org/rfc/rfc9562.html#section-5.9-4
4750
self.assertEqual(nil_uuid.variant, self.uuid.RESERVED_NCS)
51+
# A version field of all zeros is "Unused" in RFC 9562, but the version
52+
# field also only applies to the 10xx variant, i.e. the variant
53+
# specified in RFC 9562. As such, because the Nil UUID falls under a
54+
# different variant, its version is considered undefined.
55+
# See https://www.rfc-editor.org/rfc/rfc9562.html#table2
56+
self.assertIsNone(nil_uuid.version)
4857

4958
def test_max_uuid(self):
5059
max_uuid = self.uuid.MAX
@@ -55,8 +64,18 @@ def test_max_uuid(self):
5564
self.assertEqual(max_uuid, self.uuid.UUID(int=i))
5665
self.assertEqual(max_uuid.int, i)
5766
self.assertEqual(str(max_uuid), s)
58-
self.assertIsNone(max_uuid.version)
67+
# The Max UUID falls within the range of the "yet-to-be defined" future
68+
# UUID variant as per RFC 9562.
69+
# See https://www.rfc-editor.org/rfc/rfc9562.html#table1
70+
# See https://www.rfc-editor.org/rfc/rfc9562.html#section-5.10-4
5971
self.assertEqual(max_uuid.variant, self.uuid.RESERVED_FUTURE)
72+
# A version field of all ones is "Reserved for future definition" in
73+
# RFC 9562, but the version field also only applies to the 10xx
74+
# variant, i.e. the variant specified in RFC 9562. As such, because the
75+
# Max UUID falls under a different variant, its version is considered
76+
# undefined.
77+
# See https://www.rfc-editor.org/rfc/rfc9562.html#table2
78+
self.assertIsNone(max_uuid.version)
6079

6180
def test_safe_uuid_enum(self):
6281
class CheckedSafeUUID(enum.Enum):

0 commit comments

Comments
 (0)