FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-31643: test_uuid: allow zero MAC address by native-api · Pull Request #4448 · python/cpython · GitHub

/ cpython Public
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
10 changes: 7 additions & 3 deletions Lib/test/test_uuid.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Back | FazBrowse Home | New Git URL