From 4c37278b27b9f26dd63e677f0028cbb0cd6bd36b Mon Sep 17 00:00:00 2001 From: Jonathan Lange Date: Sat, 26 Jan 2013 15:10:56 +0000 Subject: [PATCH 1/5] Refer to LICENSE, rather than README --- Makefile | 2 +- testtools/tests/__init__.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b3e40ec..72687c9 100644 --- a/Makefile +++ b/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") diff --git a/testtools/tests/__init__.py b/testtools/tests/__init__.py index df9d44b..db215ff 100644 --- a/testtools/tests/__init__.py +++ b/testtools/tests/__init__.py @@ -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 From 814ff44cdcb7383075ffcdd9800b1e9bc2293e72 Mon Sep 17 00:00:00 2001 From: Jonathan Lange Date: Sat, 26 Jan 2013 15:12:10 +0000 Subject: [PATCH 2/5] Rename README to README.rst This is so the README on Github will look pretty. --- MANIFEST.in | 2 +- README => README.rst | 0 doc/hacking.rst | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename README => README.rst (100%) diff --git a/MANIFEST.in b/MANIFEST.in index 7da191a..d03bbab 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,7 +2,7 @@ include LICENSE include Makefile include MANIFEST.in include NEWS -include README +include README.rst include .bzrignore graft doc graft doc/_static diff --git a/README b/README.rst similarity index 100% rename from README rename to README.rst diff --git a/doc/hacking.rst b/doc/hacking.rst index f379d61..95f4df1 100644 --- a/doc/hacking.rst +++ b/doc/hacking.rst @@ -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” From b988607d5713053034b44d432851b7cf9be6c120 Mon Sep 17 00:00:00 2001 From: Jonathan Lange Date: Sat, 26 Jan 2013 16:02:51 +0000 Subject: [PATCH 3/5] Fix minor rST error --- NEWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS b/NEWS index df08bec..b76bd5d 100644 --- a/NEWS +++ b/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 From 95bd0588cca67031fba3f4602e7c07f5d98702ae Mon Sep 17 00:00:00 2001 From: Jonathan Lange Date: Sat, 26 Jan 2013 16:38:34 +0000 Subject: [PATCH 4/5] Code quote *args and **kwargs This fixes a documentation error, as ``*`` looks like the start of a reStructuredText emphasis. --- testtools/matchers/_higherorder.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/testtools/matchers/_higherorder.py b/testtools/matchers/_higherorder.py index 3459916..31dd0ea 100644 --- a/testtools/matchers/_higherorder.py +++ b/testtools/matchers/_higherorder.py @@ -325,12 +325,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:: From 37d7013c7793248556732e1cea6179680740e405 Mon Sep 17 00:00:00 2001 From: Jonathan Lange Date: Sat, 26 Jan 2013 16:42:51 +0000 Subject: [PATCH 5/5] Be clear on when HasLength passes or fails Piggy-backing the change on to other doc fixes. --- doc/for-test-authors.rst | 6 +++++- testtools/matchers/_higherorder.py | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/for-test-authors.rst b/doc/for-test-authors.rst index c5cd972..25394cb 100644 --- a/doc/for-test-authors.rst +++ b/doc/for-test-authors.rst @@ -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 ~~~~~~~~~~~~~~ diff --git a/testtools/matchers/_higherorder.py b/testtools/matchers/_higherorder.py index 31dd0ea..4806136 100644 --- a/testtools/matchers/_higherorder.py +++ b/testtools/matchers/_higherorder.py @@ -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