Kaydet (Commit) 9858f635 authored tarafından Andrew M. Kuchling's avatar Andrew M. Kuchling

add some unittest items

üst 446ff148
...@@ -1139,21 +1139,28 @@ GvR worked on merging them into Python's version of :mod:`unittest`. ...@@ -1139,21 +1139,28 @@ GvR worked on merging them into Python's version of :mod:`unittest`.
* :meth:`loadTestsFromName` properly honors the ``suiteClass`` attribute of * :meth:`loadTestsFromName` properly honors the ``suiteClass`` attribute of
the :class:`TestLoader`. (Fixed by Mark Roddy; :issue:`6866`.) the :class:`TestLoader`. (Fixed by Mark Roddy; :issue:`6866`.)
* A new hook, :meth:`addTypeEqualityFunc` takes a type object and a * A new hook lets you extend the :meth:`assertEqual` method to handle
function. The :meth:`assertEqual` method will use the function new data types. The :meth:`addTypeEqualityFunc` method takes a type
when both of the objects being compared are of the specified type. object and a function. The function will be used when both of the
This function should compare the two objects and raise an objects being compared are of the specified type. This function
exception if they don't match; it's a good idea for the function should compare the two objects and raise an exception if they don't
to provide additional information about why the two objects are match; it's a good idea for the function to provide additional
matching, much as the new sequence comparison methods do. information about why the two objects are matching, much as the new
sequence comparison methods do.
:func:`unittest.main` now takes an optional ``exit`` argument.
If False ``main`` doesn't call :func:`sys.exit` allowing it to :func:`unittest.main` now takes an optional ``exit`` argument. If
be used from the interactive interpreter. :issue:`3379`. false, :func:`main` doesn't call :func:`sys.exit`, allowing it to be
used from the interactive interpreter. (Contributed by J. Pablo
Fernández; :issue:`3379`.)
A new command-line switch, :option:`-f` or :option:`--failfast`, makes
test execution stop immediately when a test fails instead of
continuing to execute further tests. (Suggested by Cliff Dyer and
implemented by Michael Foord; :issue:`8074`.)
:class:`TestResult` has new :meth:`startTestRun` and :class:`TestResult` has new :meth:`startTestRun` and
:meth:`stopTestRun` methods; called immediately before :meth:`stopTestRun` methods that are called immediately before
and after a test run. :issue:`5728` by Robert Collins. and after a test run. (Contributed by Robert Collins; :issue:`5728`.)
With all these changes, the :file:`unittest.py` was becoming awkwardly With all these changes, the :file:`unittest.py` was becoming awkwardly
large, so the module was turned into a package and the code split into large, so the module was turned into a package and the code split into
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment