← Back to team overview

testtools-dev team mailing list archive

Re: [RFC] assert_that function

 

On Tue, Dec 03, 2013 at 02:55:59PM +0000, Jonathan Lange wrote:
> I think it's a good idea, see
> https://bugs.launchpad.net/testtools/+bug/1243834
> 
> Notionally, TestCase.failException is a public, writeable attribute that
> can change. Tests must raise self.failException if they want to fail rather
> than error.

The current implementation of assertThat doesn't do this, if I
understand correctly:
https://github.com/testing-cabal/testtools/blob/master/testtools/testcase.py#L414

We could dynamically create our mismatch exceptions by mixing the
MismatchError behaviour in to a failure exception that is passed to
assert_that?  TestCase.assertThat could just pass in
self.failException...

> It might be nice to have an even lower level function that does not
> assume MismatchError.

Not 100% sure what you mean here; a lower-level function that just
raises an AssertionError which we catch and raise a MismatchError
instead of?

> Parametrizing the tests would be nice.

:)


References