This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rbcollins
Recipients Julian, aliles, ezio.melotti, michael.foord, ncoghlan, rbcollins, rhettinger, serhiy.storchaka
Date 2013-06-09.05:11:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Hey, feel free to +nosy me on unittest things :). Julian pinged me on IRC about this - Jml and I would be delight to prepare a patchset for assertThat for unittest and as much of the core of Matchers as makes sense. The bare core can come in without any of the things that Michael is concerned about vis-a-vis unneeded complexity in testtools [e.g. nothing about arbitrary attachments is needed].

We can state from experience - both ours and users that have adopted it - that the decoupling assertThat brings is very effective at ending the forced-hierarchy-or-mixin mess that self-homed assertions brings. A while back we rewrote the entire core of testtools own assertions to be Matcher based :). has the documentation on the Matcher protocol and what it looks like for users.

Structurally, we decouple the raising of AssertionError from the act of determining whether a particular condition is met - this frees one from needing to have a reference to a test case to honour failureException, and from needing to subclass to share condition logic - unrelated test classes can how share condition logic by sharing a matcher definition.

It also lends itself rather naturally to higher order definitions of matchers, as matchers are now standalone objects with no required connection to a test case : you can curry and compose matchers easily.

We make matchers have a nice __str__, so that their structure can be printed out by assertThat when an error has occurred even if they have been curried or compose or defined much earlier.

So - is there some interest in this? If so, I can put together a patchset with just the core, and let you see what it looks like.
Date User Action Args
2013-06-09 05:11:18rbcollinssetrecipients: + rbcollins, rhettinger, ncoghlan, ezio.melotti, michael.foord, Julian, aliles, serhiy.storchaka
2013-06-09 05:11:18rbcollinssetmessageid: <>
2013-06-09 05:11:18rbcollinslinkissue18054 messages
2013-06-09 05:11:17rbcollinscreate