Lines Matching full:uuid
13 py_uuid = support.import_fresh_module('uuid', blocked=['_uuid'])
14 c_uuid = support.import_fresh_module('uuid', fresh=['_uuid'])
31 uuid = None variable in BaseTestUUID
45 'urn:uuid:00000000-0000-0000-0000-000000000000',
46 0, 0, self.uuid.RESERVED_NCS, None),
54 'urn:uuid:00010203-0405-0607-0809-0a0b0c0d0e0f',
55 0x607040500010203, 0x809, self.uuid.RESERVED_NCS, None),
63 'urn:uuid:02d9e6d5-9467-382e-8f9b-9300a64ac3cd',
64 0x82e946702d9e6d5, 0xf9b, self.uuid.RFC_4122, 3),
72 'urn:uuid:12345678-1234-5678-1234-567812345678',
73 0x678123412345678, 0x1234, self.uuid.RESERVED_NCS, None),
81 'urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8',
82 0x1d19dad6ba7b810, 0xb4, self.uuid.RFC_4122, 1),
90 'urn:uuid:6ba7b811-9dad-11d1-80b4-00c04fd430c8',
91 0x1d19dad6ba7b811, 0xb4, self.uuid.RFC_4122, 1),
99 'urn:uuid:6ba7b812-9dad-11d1-80b4-00c04fd430c8',
100 0x1d19dad6ba7b812, 0xb4, self.uuid.RFC_4122, 1),
108 'urn:uuid:6ba7b814-9dad-11d1-80b4-00c04fd430c8',
109 0x1d19dad6ba7b814, 0xb4, self.uuid.RFC_4122, 1),
117 'urn:uuid:7d444840-9dc0-11d1-b245-5ffdce74fad2',
118 0x1d19dc07d444840, 0x3245, self.uuid.RFC_4122, 1),
126 'urn:uuid:e902893a-9d22-3c7e-a7b8-d6e313b71d9f',
127 0xc7e9d22e902893a, 0x27b8, self.uuid.RFC_4122, 3),
135 'urn:uuid:eb424026-6f54-4ef8-a4d0-bb658a1fc6cf',
136 0xef86f54eb424026, 0x24d0, self.uuid.RFC_4122, 4),
144 'urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6',
145 0x1d07decf81d4fae, 0x2765, self.uuid.RFC_4122, 1),
153 'urn:uuid:fffefdfc-fffe-fffe-fffe-fffefdfcfbfa',
154 0xffefffefffefdfc, 0x3ffe, self.uuid.RESERVED_FUTURE, None),
162 'urn:uuid:ffffffff-ffff-ffff-ffff-ffffffffffff',
163 0xfffffffffffffff, 0x3fff, self.uuid.RESERVED_FUTURE, None),
166 # Construct each UUID in several different ways.
167 for u in [self.uuid.UUID(string), self.uuid.UUID(curly), self.uuid.UUID(hex),
168 self.uuid.UUID(bytes=bytes), self.uuid.UUID(bytes_le=bytes_le),
169 self.uuid.UUID(fields=fields), self.uuid.UUID(int=integer),
170 self.uuid.UUID(urn)]:
171 # Test all conversions and properties of the UUID object.
192 # Different construction methods should give the same UUID.
224 badvalue(lambda: self.uuid.UUID(''))
225 badvalue(lambda: self.uuid.UUID('abc'))
226 badvalue(lambda: self.uuid.UUID('1234567812345678123456781234567'))
227 badvalue(lambda: self.uuid.UUID('123456781234567812345678123456789'))
228 badvalue(lambda: self.uuid.UUID('123456781234567812345678z2345678'))
231 badvalue(lambda: self.uuid.UUID(bytes='abc'))
232 badvalue(lambda: self.uuid.UUID(bytes='\0'*15))
233 badvalue(lambda: self.uuid.UUID(bytes='\0'*17))
236 badvalue(lambda: self.uuid.UUID(bytes_le='abc'))
237 badvalue(lambda: self.uuid.UUID(bytes_le='\0'*15))
238 badvalue(lambda: self.uuid.UUID(bytes_le='\0'*17))
241 badvalue(lambda: self.uuid.UUID(fields=(1,)))
242 badvalue(lambda: self.uuid.UUID(fields=(1, 2, 3, 4, 5)))
243 badvalue(lambda: self.uuid.UUID(fields=(1, 2, 3, 4, 5, 6, 7)))
246 badvalue(lambda: self.uuid.UUID(fields=(-1, 0, 0, 0, 0, 0)))
247 badvalue(lambda: self.uuid.UUID(fields=(0x100000000, 0, 0, 0, 0, 0)))
248 badvalue(lambda: self.uuid.UUID(fields=(0, -1, 0, 0, 0, 0)))
249 badvalue(lambda: self.uuid.UUID(fields=(0, 0x10000, 0, 0, 0, 0)))
250 badvalue(lambda: self.uuid.UUID(fields=(0, 0, -1, 0, 0, 0)))
251 badvalue(lambda: self.uuid.UUID(fields=(0, 0, 0x10000, 0, 0, 0)))
252 badvalue(lambda: self.uuid.UUID(fields=(0, 0, 0, -1, 0, 0)))
253 badvalue(lambda: self.uuid.UUID(fields=(0, 0, 0, 0x100, 0, 0)))
254 badvalue(lambda: self.uuid.UUID(fields=(0, 0, 0, 0, -1, 0)))
255 badvalue(lambda: self.uuid.UUID(fields=(0, 0, 0, 0, 0x100, 0)))
256 badvalue(lambda: self.uuid.UUID(fields=(0, 0, 0, 0, 0, -1)))
257 badvalue(lambda: self.uuid.UUID(fields=(0, 0, 0, 0, 0, 0x1000000000000)))
260 badvalue(lambda: self.uuid.UUID('00'*16, version=0))
261 badvalue(lambda: self.uuid.UUID('00'*16, version=6))
264 badvalue(lambda: self.uuid.UUID(int=-1))
265 badvalue(lambda: self.uuid.UUID(int=1<<128))
269 self.uuid.UUID(h)
270 self.uuid.UUID(hex=h)
271 self.uuid.UUID(bytes=b)
272 self.uuid.UUID(bytes_le=b)
273 self.uuid.UUID(fields=f)
274 self.uuid.UUID(int=i)
277 badtype(lambda: self.uuid.UUID())
278 badtype(lambda: self.uuid.UUID(h, b))
279 badtype(lambda: self.uuid.UUID(h, b, b))
280 badtype(lambda: self.uuid.UUID(h, b, b, f))
281 badtype(lambda: self.uuid.UUID(h, b, b, f, i))
291 badtype(lambda: self.uuid.UUID(h, **args))
293 badtype(lambda: self.uuid.UUID(**args))
296 u = self.uuid.UUID(h)
310 # Comparison with a non-UUID object
315 node1 = self.uuid.getnode()
319 node2 = self.uuid.getnode()
327 with support.swap_item(sys.modules, 'uuid', self.uuid):
328 for is_safe in self.uuid.SafeUUID:
329 u = self.uuid.UUID('d82579ce6642a0de7ddf490a7aec7aa5',
439 u = self.uuid.UUID('d82579ce6642a0de7ddf490a7aec7aa5')
440 u_safe = self.uuid.UUID('d82579ce6642a0de7ddf490a7aec7aa5',
441 is_safe=self.uuid.SafeUUID.safe)
442 u_unsafe = self.uuid.UUID('d82579ce6642a0de7ddf490a7aec7aa5',
443 is_safe=self.uuid.SafeUUID.unsafe)
445 with support.swap_item(sys.modules, 'uuid', self.uuid):
459 # Confirm that uuid.getnode ignores hardware addresses larger than 48
462 # uuid.getnode to fall back on uuid._random_getnode, which will
466 self.uuid,
470 node = self.uuid.getnode()
474 # uuid.getnode fell back on uuid._random_getnode() rather than using
477 self.uuid.uuid1(node=node)
485 for u in [self.uuid.uuid1() for i in range(10)]:
486 equal(u.variant, self.uuid.RFC_4122)
488 self.assertIn(u.is_safe, {self.uuid.SafeUUID.safe,
489 self.uuid.SafeUUID.unsafe,
490 self.uuid.SafeUUID.unknown})
494 for u in [self.uuid.uuid1() for i in range(1000)]:
498 # Make sure the supplied node ID appears in the UUID.
499 u = self.uuid.uuid1(0)
501 u = self.uuid.uuid1(0x123456789abc)
503 u = self.uuid.uuid1(0xffffffffffff)
506 # Make sure the supplied clock sequence appears in the UUID.
507 u = self.uuid.uuid1(0x123456789abc, 0)
510 u = self.uuid.uuid1(0x123456789abc, 0x1234)
514 u = self.uuid.uuid1(0x123456789abc, 0x3fff)
519 # bpo-29925: On Mac OS X Tiger, self.uuid.uuid1().is_safe returns
520 # self.uuid.SafeUUID.unknown
524 if not self.uuid._has_uuid_generate_time_safe:
527 u = self.uuid.uuid1()
531 self.assertNotEqual(u.is_safe, self.uuid.SafeUUID.unknown)
536 Mock uuid._generate_time_safe() to return a given *safe_value*.
540 self.uuid._load_system_functions()
541 f = self.uuid._generate_time_safe
543 self.skipTest('need uuid._generate_time_safe')
544 with mock.patch.object(self.uuid, '_generate_time_safe',
553 u = self.uuid.uuid1()
554 self.assertEqual(u.is_safe, self.uuid.SafeUUID.unknown)
559 u = self.uuid.uuid1()
560 self.assertEqual(u.is_safe, self.uuid.SafeUUID.safe)
565 u = self.uuid.uuid1()
566 self.assertEqual(u.is_safe, self.uuid.SafeUUID.unsafe)
571 u = self.uuid.uuid1()
572 self.assertEqual(u.is_safe, self.uuid.SafeUUID.unknown)
575 with mock.patch.object(self.uuid, '_has_uuid_generate_time_safe', False), \
576 mock.patch.object(self.uuid, '_generate_time_safe', None), \
577 mock.patch.object(self.uuid, '_last_timestamp', None), \
578 mock.patch.object(self.uuid, 'getnode', return_value=93328246233727), \
581 u = self.uuid.uuid1()
582 self.assertEqual(u, self.uuid.UUID('a7a55b92-01fc-11e9-94c5-54e1acf6da7f'))
584 with mock.patch.object(self.uuid, '_has_uuid_generate_time_safe', False), \
585 mock.patch.object(self.uuid, '_generate_time_safe', None), \
586 mock.patch.object(self.uuid, '_last_timestamp', None), \
588 u = self.uuid.uuid1(node=93328246233727, clock_seq=5317)
589 self.assertEqual(u, self.uuid.UUID('a7a55b92-01fc-11e9-94c5-54e1acf6da7f'))
595 for u, v in [(self.uuid.uuid3(self.uuid.NAMESPACE_DNS, 'python.org'),
597 (self.uuid.uuid3(self.uuid.NAMESPACE_URL, 'http://python.org/'),
599 (self.uuid.uuid3(self.uuid.NAMESPACE_OID, '1.3.6.1'),
601 (self.uuid.uuid3(self.uuid.NAMESPACE_X500, 'c=ca'),
604 equal(u.variant, self.uuid.RFC_4122)
606 equal(u, self.uuid.UUID(v))
613 for u in [self.uuid.uuid4() for i in range(10)]:
614 equal(u.variant, self.uuid.RFC_4122)
619 for u in [self.uuid.uuid4() for i in range(1000)]:
627 for u, v in [(self.uuid.uuid5(self.uuid.NAMESPACE_DNS, 'python.org'),
629 (self.uuid.uuid5(self.uuid.NAMESPACE_URL, 'http://python.org/'),
631 (self.uuid.uuid5(self.uuid.NAMESPACE_OID, '1.3.6.1'),
633 (self.uuid.uuid5(self.uuid.NAMESPACE_X500, 'c=ca'),
636 equal(u.variant, self.uuid.RFC_4122)
638 equal(u, self.uuid.UUID(v))
643 # On at least some versions of OSX self.uuid.uuid4 generates
650 value = self.uuid.uuid4()
657 parent_value = self.uuid.uuid4().hex
664 # bpo-35701: check that weak referencing to a UUID object can be created
665 strong = self.uuid.uuid4()
670 uuid = py_uuid variable in TestUUIDWithoutExtModule
674 uuid = c_uuid variable in TestUUIDWithExtModule
682 patch = mock.patch.multiple(self.uuid,
686 patch = mock.patch.multiple(self.uuid,
703 self.assertEqual(self.uuid._parse_mac(mac), expected)
724 self.assertIsNone(self.uuid._parse_mac(mac))
745 with mock.patch.multiple(self.uuid,
749 mac = self.uuid._find_mac_under_heading(
782 with mock.patch.multiple(self.uuid,
786 mac = self.uuid._find_mac_under_heading(
803 with mock.patch.multiple(self.uuid,
807 mac = self.uuid._find_mac_near_keyword(
828 node = self.uuid._ifconfig_getnode()
834 node = self.uuid._ip_getnode()
840 node = self.uuid._arp_getnode()
846 node = self.uuid._lanscan_getnode()
852 node = self.uuid._netstat_getnode()
856 node = self.uuid._random_getnode()
863 node2 = self.uuid._random_getnode()
867 uuid = py_uuid variable in TestInternalsWithoutExtModule
871 uuid = c_uuid variable in TestInternalsWithExtModule
878 node = self.uuid._unix_getnode()
885 node = self.uuid._windll_getnode()