summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/test/test_uuid.py32
1 files changed, 9 insertions, 23 deletions
diff --git a/Lib/test/test_uuid.py b/Lib/test/test_uuid.py
index 89e221b..c22b6af 100644
--- a/Lib/test/test_uuid.py
+++ b/Lib/test/test_uuid.py
@@ -292,14 +292,8 @@ class TestUUID(TestCase):
badtype(lambda: setattr(u, 'node', 0))
def check_node(self, node, source):
- individual_group_bit = (node >> 40) & 1
- universal_local_bit = (node >> 40) & 2
- message = "%012x doesn't look like a real MAC address" % node
- self.assertEqual(individual_group_bit, 0, message)
- self.assertEqual(universal_local_bit, 0, message)
- self.assertNotEqual(node, 0, message)
- self.assertNotEqual(node, 0xffffffffffff, message)
- self.assertTrue(0 <= node, message)
+ message = "%012x is not an RFC 4122 node ID" % node
+ self.assertTrue(0 < node, message)
self.assertTrue(node < (1 << 48), message)
TestUUID.source2node[source] = node
@@ -318,10 +312,6 @@ class TestUUID(TestCase):
def test_ifconfig_getnode(self):
import sys
- print(""" WARNING: uuid._ifconfig_getnode is unreliable on many platforms.
- It is disabled until the code and/or test can be fixed properly.""", file=sys.__stdout__)
- return
-
import os
if os.name == 'posix':
node = uuid._ifconfig_getnode()
@@ -341,18 +331,18 @@ class TestUUID(TestCase):
def test_random_getnode(self):
node = uuid._random_getnode()
- self.assertTrue(0 <= node)
- self.assertTrue(node < (1 <<48))
+ # Least significant bit of first octet must be set.
+ self.assertTrue(node & 0x010000000000)
+ self.assertTrue(node < (1 << 48))
def test_unixdll_getnode(self):
import sys
- print(""" WARNING: uuid._unixdll_getnode is unreliable on many platforms.
- It is disabled until the code and/or test can be fixed properly.""", file=sys.__stdout__)
- return
-
import os
if importable('ctypes') and os.name == 'posix':
- self.check_node(uuid._unixdll_getnode(), 'unixdll')
+ try: # Issues 1481, 3581: _uuid_generate_time() might be None.
+ self.check_node(uuid._unixdll_getnode(), 'unixdll')
+ except TypeError:
+ pass
def test_windll_getnode(self):
import os
@@ -361,10 +351,6 @@ class TestUUID(TestCase):
def test_getnode(self):
import sys
- print(""" WARNING: uuid.getnode is unreliable on many platforms.
- It is disabled until the code and/or test can be fixed properly.""", file=sys.__stdout__)
- return
-
node1 = uuid.getnode()
self.check_node(node1, "getnode1")