Merge lp:~jml/testtools/expose-dict-things into lp:~testtools-committers/testtools/trunk

Proposed by Jonathan Lange
Status: Merged
Approved by: Jonathan Lange
Approved revision: 285
Merged at revision: 285
Proposed branch: lp:~jml/testtools/expose-dict-things
Merge into: lp:~testtools-committers/testtools/trunk
Diff against target: 62 lines (+26/-0)
2 files modified
NEWS (+20/-0)
testtools/matchers/__init__.py (+6/-0)
To merge this branch: bzr merge lp:~jml/testtools/expose-dict-things
Reviewer Review Type Date Requested Status
Jonathan Lange Approve
Review via email: mp+131410@code.launchpad.net

Commit message

Expose dict matchers

Description of the change

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.

To post a comment you must log in.
Revision history for this message
Jonathan Lange (jml) wrote :

Rubberstamp

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2012-10-19 14:34:23 +0000
3+++ NEWS 2012-10-25 13:44:23 +0000
4@@ -6,6 +6,26 @@
5 NEXT
6 ~~~~
7
8+Improvements
9+------------
10+
11+* New, powerful matchers that match items in a dictionary:
12+
13+ - ``MatchesDict``, match every key in a dictionary with a key in a
14+ dictionary of matchers. For when the set of expected keys is equal to the
15+ set of observed keys.
16+
17+ - ``ContainsDict``, every key in a dictionary of matchers must be
18+ found in a dictionary, and the values for those keys must match. For when
19+ the set of expected keys is a subset of the set of observed keys.
20+
21+ - ``ContainedByDict``, every key in a dictionary must be found in
22+ a dictionary of matchers. For when the set of expected keys is a superset
23+ of the set of observed keys.
24+
25+ The names are a little confusing, sorry. We're still trying to figure out
26+ how to present the concept in the simplest way possible.
27+
28
29 0.9.19
30 ~~~~~~
31
32=== modified file 'testtools/matchers/__init__.py'
33--- testtools/matchers/__init__.py 2012-09-10 11:37:46 +0000
34+++ testtools/matchers/__init__.py 2012-10-25 13:44:23 +0000
35@@ -18,6 +18,8 @@
36 'Annotate',
37 'Contains',
38 'ContainsAll',
39+ 'ContainedByDict',
40+ 'ContainsDict',
41 'DirExists',
42 'DocTestMatches',
43 'EndsWith',
44@@ -32,6 +34,7 @@
45 'LessThan',
46 'MatchesAll',
47 'MatchesAny',
48+ 'MatchesDict',
49 'MatchesException',
50 'MatchesListwise',
51 'MatchesPredicate',
52@@ -67,7 +70,10 @@
53 MatchesStructure,
54 )
55 from ._dict import (
56+ ContainedByDict,
57+ ContainsDict,
58 KeysEqual,
59+ MatchesDict,
60 )
61 from ._doctest import (
62 DocTestMatches,

Subscribers

People subscribed via source and target branches