Create assert_that function and use it from TestCase.assertThat. #70
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This will allow matchers to be used outside of the TestCase context. This is useful for people who can't buy in to testtools.TestCase fully (for whatever reason), or who like using function/generator tests (as supported by nose).
This isn't a full patch (and so shouldn't be merged as-is), but I wanted to get feedback on whether this approach would be acceptable before doing anything else.
Assuming it is acceptable, thoughts on how best to test it would be appreciated. My initial instinct was to modify all of the tests exercising the core behaviour I've extracted to point at
assert_that
and write some new tests to ensure thatassertThat
consumes theassert_that
API correctly.However, as we will be exposing essentially the same API in two places (
assert_that
andself.assertThat
), I wonder if we should run the core-behaviour tests against both places by parameterising them somehow, so we're fully testing our public API. Thoughts appreciated.This will fix https://bugs.launchpad.net/testtools/+bug/1243834 (by providing the global function mentioned in the title).