From e4d1417e99f4f073895b346802051608a69d49a9 Mon Sep 17 00:00:00 2001 From: Ivan Pozdeev Date: Sat, 18 Nov 2017 06:35:07 +0300 Subject: [PATCH 1/3] Allows for all-zero MAC address (e.g. mobile modem) --- Lib/test/test_uuid.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_uuid.py b/Lib/test/test_uuid.py index 083c2aa8aab54d..bd51bea3f385e4 100644 --- a/Lib/test/test_uuid.py +++ b/Lib/test/test_uuid.py @@ -305,7 +305,7 @@ def test_exceptions(self): def test_getnode(self): node1 = self.uuid.getnode() - self.assertTrue(0 < node1 < (1 << 48), '%012x' % node1) + self.assertTrue(0 <= node1 < (1 << 48), '%012x' % node1) # Test it again to ensure consistency. node2 = self.uuid.getnode() @@ -522,7 +522,7 @@ def check_node(self, node, requires=None, network=False): # 47 bit will never be set in IEEE 802 addresses obtained # from network cards. self.assertFalse(node & 0x010000000000, hex) - self.assertTrue(0 < node < (1 << 48), + self.assertTrue(0 <= node < (1 << 48), "%s is not an RFC 4122 node ID" % hex) @unittest.skipUnless(os.name == 'posix', 'requires Posix') From 0b4a2fa1bf62f421ca1252decc58750b83a7209c Mon Sep 17 00:00:00 2001 From: Ivan Pozdeev Date: Sat, 18 Nov 2017 06:36:18 +0300 Subject: [PATCH 2/3] node from _windll_getnode is always MAC-based --- Lib/test/test_uuid.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_uuid.py b/Lib/test/test_uuid.py index bd51bea3f385e4..efc38ff3041ca3 100644 --- a/Lib/test/test_uuid.py +++ b/Lib/test/test_uuid.py @@ -581,7 +581,7 @@ def test_unix_getnode(self): @unittest.skipUnless(importable('ctypes'), 'requires ctypes') def test_windll_getnode(self): node = self.uuid._windll_getnode() - self.check_node(node) + self.check_node(node, network=True) class TestInternalsWithoutExtModule(BaseTestInternals, unittest.TestCase): From 07c89719cabebaffc892a437ae420624402011c6 Mon Sep 17 00:00:00 2001 From: Ivan Pozdeev Date: Sat, 18 Nov 2017 06:37:19 +0300 Subject: [PATCH 3/3] -duplication --- Lib/test/test_uuid.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_uuid.py b/Lib/test/test_uuid.py index efc38ff3041ca3..4b5c15db7b021a 100644 --- a/Lib/test/test_uuid.py +++ b/Lib/test/test_uuid.py @@ -305,7 +305,7 @@ def test_exceptions(self): def test_getnode(self): node1 = self.uuid.getnode() - self.assertTrue(0 <= node1 < (1 << 48), '%012x' % node1) + self.check_node(node1) # Test it again to ensure consistency. node2 = self.uuid.getnode()