Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Lib/test/test_uuid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -518,7 +518,11 @@ def check_node(self, node, requires=None):
hex = '%012x' % node
if support.verbose >= 2:
print(hex, end=' ')
self.assertTrue(0 < node < (1 << 48),
if network:
# 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),
"%s is not an RFC 4122 node ID" % hex)

@unittest.skipUnless(os.name == 'posix', 'requires Posix')
Expand Down Expand Up @@ -582,7 +586,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):
Expand Down