mirror of https://github.com/python/cpython
Issue #26267: Merge from 3.6
This commit is contained in:
commit
81b64ff01b
|
@ -45,6 +45,13 @@ random UUID.
|
||||||
variant and version number set according to RFC 4122, overriding bits in the
|
variant and version number set according to RFC 4122, overriding bits in the
|
||||||
given *hex*, *bytes*, *bytes_le*, *fields*, or *int*.
|
given *hex*, *bytes*, *bytes_le*, *fields*, or *int*.
|
||||||
|
|
||||||
|
Comparison of UUID objects are made by way of comparing their
|
||||||
|
:attr:`UUID.int` attributes. Comparison with a non-UUID object
|
||||||
|
raises a :exc:`TypeError`.
|
||||||
|
|
||||||
|
``str(uuid)`` returns a string in the form
|
||||||
|
``12345678-1234-5678-1234-567812345678`` where the 32 hexadecimal digits
|
||||||
|
represent the UUID.
|
||||||
|
|
||||||
:class:`UUID` instances have these read-only attributes:
|
:class:`UUID` instances have these read-only attributes:
|
||||||
|
|
||||||
|
|
|
@ -292,6 +292,10 @@ class TestUUID(unittest.TestCase):
|
||||||
badtype(lambda: setattr(u, 'clock_seq_low', 0))
|
badtype(lambda: setattr(u, 'clock_seq_low', 0))
|
||||||
badtype(lambda: setattr(u, 'node', 0))
|
badtype(lambda: setattr(u, 'node', 0))
|
||||||
|
|
||||||
|
# Comparison with a non-UUID object
|
||||||
|
badtype(lambda: u < object())
|
||||||
|
badtype(lambda: u > object())
|
||||||
|
|
||||||
def test_getnode(self):
|
def test_getnode(self):
|
||||||
node1 = uuid.getnode()
|
node1 = uuid.getnode()
|
||||||
self.assertTrue(0 < node1 < (1 << 48), '%012x' % node1)
|
self.assertTrue(0 < node1 < (1 << 48), '%012x' % node1)
|
||||||
|
|
Loading…
Reference in New Issue