testtools-dev team mailing list archive
-
testtools-dev team
-
Mailing list archive
-
Message #01119
[Merge] lp:~jml/testtools/expose-dict-things into lp:testtools
Jonathan Lange has proposed merging lp:~jml/testtools/expose-dict-things into lp:testtools.
Commit message:
Expose dict matchers
Requested reviews:
Jonathan Lange (jml)
For more details, see:
https://code.launchpad.net/~jml/testtools/expose-dict-things/+merge/131410
I added these a while ago, but never announced them in NEWS.
Further, the matchers.py restructure means that code that I had previously
will no longer work. So this re-exposes them and announces them.
--
https://code.launchpad.net/~jml/testtools/expose-dict-things/+merge/131410
Your team testtools developers is subscribed to branch lp:testtools.
=== modified file 'NEWS'
--- NEWS 2012-10-19 14:34:23 +0000
+++ NEWS 2012-10-25 13:44:23 +0000
@@ -6,6 +6,26 @@
NEXT
~~~~
+Improvements
+------------
+
+* New, powerful matchers that match items in a dictionary:
+
+ - ``MatchesDict``, match every key in a dictionary with a key in a
+ dictionary of matchers. For when the set of expected keys is equal to the
+ set of observed keys.
+
+ - ``ContainsDict``, every key in a dictionary of matchers must be
+ found in a dictionary, and the values for those keys must match. For when
+ the set of expected keys is a subset of the set of observed keys.
+
+ - ``ContainedByDict``, every key in a dictionary must be found in
+ a dictionary of matchers. For when the set of expected keys is a superset
+ of the set of observed keys.
+
+ The names are a little confusing, sorry. We're still trying to figure out
+ how to present the concept in the simplest way possible.
+
0.9.19
~~~~~~
=== modified file 'testtools/matchers/__init__.py'
--- testtools/matchers/__init__.py 2012-09-10 11:37:46 +0000
+++ testtools/matchers/__init__.py 2012-10-25 13:44:23 +0000
@@ -18,6 +18,8 @@
'Annotate',
'Contains',
'ContainsAll',
+ 'ContainedByDict',
+ 'ContainsDict',
'DirExists',
'DocTestMatches',
'EndsWith',
@@ -32,6 +34,7 @@
'LessThan',
'MatchesAll',
'MatchesAny',
+ 'MatchesDict',
'MatchesException',
'MatchesListwise',
'MatchesPredicate',
@@ -67,7 +70,10 @@
MatchesStructure,
)
from ._dict import (
+ ContainedByDict,
+ ContainsDict,
KeysEqual,
+ MatchesDict,
)
from ._doctest import (
DocTestMatches,
Follow ups