xml.dom.Element.setAttribute()

Element.setAttribute(name, value) Set an attribute value from a string.

unittest.mock.Mock.called

called A boolean representing whether or not the mock object has been called: >>> mock = Mock(return_value=None) >>> mock.called False >>> mock() >>> mock.called True

bisect.insort_left()

bisect.insort_left(a, x, lo=0, hi=len(a)) Insert x in a in sorted order. This is equivalent to a.insert(bisect.bisect_left(a, x, lo, hi), x) assuming that a is already sorted. Keep in mind that the O(log n) search is dominated by the slow O(n) insertion step.

weakref.ReferenceError

exception weakref.ReferenceError Exception raised when a proxy object is used but the underlying object has been collected. This is the same as the standard ReferenceError exception.

email.message_from_file()

email.message_from_file(fp, _class=email.message.Message, *, policy=policy.compat32) Return a message object structure tree from an open file object. This is exactly equivalent to Parser().parse(fp). _class and policy are interpreted as with the Parser class constructor. Changed in version 3.3: Removed the strict argument. Added the policy keyword.

test.support.temp_dir()

test.support.temp_dir(path=None, quiet=False) A context manager that creates a temporary directory at path and yields the directory. If path is None, the temporary directory is created using tempfile.mkdtemp(). If quiet is False, the context manager raises an exception on error. Otherwise, if path is specified and cannot be created, only a warning is issued.

sys.maxunicode

sys.maxunicode An integer giving the value of the largest Unicode code point, i.e. 1114111 (0x10FFFF in hexadecimal). Changed in version 3.3: Before PEP 393, sys.maxunicode used to be either 0xFFFF or 0x10FFFF, depending on the configuration option that specified whether Unicode characters were stored as UCS-2 or UCS-4.

operator.__index__()

operator.__index__(a) Return a converted to an integer. Equivalent to a.__index__().

xml.etree.ElementTree.dump()

xml.etree.ElementTree.dump(elem) Writes an element tree or element structure to sys.stdout. This function should be used for debugging only. The exact output format is implementation dependent. In this version, it’s written as an ordinary XML file. elem is an element tree or an individual element.

unittest.TestCase.assertIsNotNone()

assertIsNotNone(expr, msg=None) Test that expr is (or is not) None. New in version 3.1.