Merge branch 'master' of github.com:jml/testtools into git-not-bzr
Conflicts: MANIFEST.in
This commit is contained in:
@@ -2,7 +2,7 @@ include LICENSE
|
||||
include Makefile
|
||||
include MANIFEST.in
|
||||
include NEWS
|
||||
include README
|
||||
include README.rst
|
||||
include .gitignore
|
||||
graft doc
|
||||
graft doc/_static
|
||||
|
||||
2
Makefile
2
Makefile
@@ -1,4 +1,4 @@
|
||||
# See README for copyright and licensing details.
|
||||
# Copyright (c) 2008-2013 testtools developers. See LICENSE for details.
|
||||
|
||||
PYTHON=python
|
||||
SOURCES=$(shell find testtools -name "*.py")
|
||||
|
||||
2
NEWS
2
NEWS
@@ -260,7 +260,7 @@ Improvements
|
||||
* API documentation corrections. (Raphaël Badin)
|
||||
|
||||
* ``ConcurrentTestSuite`` now takes an optional ``wrap_result`` parameter
|
||||
that can be used to wrap the ``ThreadsafeForwardingResult``s created by
|
||||
that can be used to wrap the ``ThreadsafeForwardingResults`` created by
|
||||
the suite. (Jonathan Lange)
|
||||
|
||||
* ``Tagger`` added. It's a new ``TestResult`` that tags all tests sent to
|
||||
|
||||
@@ -524,10 +524,14 @@ file against an arbitrary matcher::
|
||||
HasLength
|
||||
~~~~~~~~~
|
||||
|
||||
Check the length of a collection. For example::
|
||||
Check the length of a collection. The following assertion will fail::
|
||||
|
||||
self.assertThat([1, 2, 3], HasLength(2))
|
||||
|
||||
But this one won't::
|
||||
|
||||
self.assertThat([1, 2, 3], HasLength(3))
|
||||
|
||||
|
||||
HasPermissions
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
@@ -63,7 +63,7 @@ Source layout
|
||||
-------------
|
||||
|
||||
The top-level directory contains the ``testtools/`` package directory, and
|
||||
miscellaneous files like ``README`` and ``setup.py``.
|
||||
miscellaneous files like ``README.rst`` and ``setup.py``.
|
||||
|
||||
The ``testtools/`` directory is the Python package itself. It is separated
|
||||
into submodules for internal clarity, but all public APIs should be “promoted”
|
||||
|
||||
@@ -298,6 +298,7 @@ def MatchesPredicateWithParams(predicate, message, name=None):
|
||||
|
||||
HasLength = MatchesPredicate(
|
||||
lambda x, y: len(x) == y, 'len({0}) is not {1}')
|
||||
# This assertion will fail, as 'len([1, 2]) == 3' is False.
|
||||
self.assertThat([1, 2], HasLength(3))
|
||||
|
||||
Note that unlike MatchesPredicate MatchesPredicateWithParams returns a
|
||||
@@ -325,12 +326,13 @@ class _MatchesPredicateWithParams(Matcher):
|
||||
"""Create a ``MatchesPredicateWithParams`` matcher.
|
||||
|
||||
:param predicate: A function that takes an object to match and
|
||||
additional params as given in *args and **kwargs. The result of the
|
||||
function will be interpreted as a boolean to determine a match.
|
||||
additional params as given in ``*args`` and ``**kwargs``. The
|
||||
result of the function will be interpreted as a boolean to
|
||||
determine a match.
|
||||
:param message: A message to describe a mismatch. It will be formatted
|
||||
with .format() and be given a tuple containing whatever was passed
|
||||
to ``match()`` + *args in *args, and whatever was passed to
|
||||
**kwargs as its **kwargs.
|
||||
to ``match()`` + ``*args`` in ``*args``, and whatever was passed to
|
||||
``**kwargs`` as its ``**kwargs``.
|
||||
|
||||
For instance, to format a single parameter::
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Copyright (c) 2008-2013 testtools developers. See LICENSE for details.
|
||||
|
||||
"""Tests for testtools itself."""
|
||||
|
||||
# See README for copyright and licensing details.
|
||||
|
||||
from unittest import TestSuite
|
||||
|
||||
|
||||
Reference in New Issue
Block a user