File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66
77from uuid6 import UUID , uuid6 , uuid7
88
9+ REGEX_UUID6 = r"^[0-9a-f]{8}-[0-9a-f]{4}-6[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
10+ REGEX_UUID7 = r"^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
911YEAR_IN_NS = 3600 * 24 * 36525 * 10 ** 7
1012
1113
@@ -14,6 +16,7 @@ def test_uuid6_generation(self):
1416 uuid6_1 = uuid6 ()
1517 self .assertEqual (uuid6_1 .version , 6 )
1618 for _ in range (1000 ):
19+ self .assertRegex (str (uuid6_1 ), REGEX_UUID6 )
1720 uuid6_2 = uuid6 ()
1821 self .assertLess (uuid6_1 , uuid6_2 )
1922 uuid6_1 = uuid6_2
@@ -22,6 +25,7 @@ def test_uuid7_generation(self):
2225 uuid7_1 = uuid7 ()
2326 self .assertEqual (uuid7_1 .version , 7 )
2427 for _ in range (1000 ):
28+ self .assertRegex (str (uuid7_1 ), REGEX_UUID7 )
2529 uuid7_2 = uuid7 ()
2630 self .assertLess (uuid7_1 , uuid7_2 )
2731 uuid7_1 = uuid7_2
You can’t perform that action at this time.
0 commit comments