pyhamcrest-metamatchers

A library for testing pyhamcrest matchers.


License
BSD-3-Clause
Install
pip install pyhamcrest-metamatchers==0.2.1

Documentation

pyhamcrest_metamatchers

Documentation Status Build Status

Some matchers for testing pyhamcrest-style matchers.

For now, we have only one of them. More to come.

This is a short example of the usage (with pytest):

    def test_wrong_status_with_wrong_headers(self, response_200):
        assert_that(
            status(300).with_headers({"Hello-Dude": "application/json"}),
            doesnt_match(response_200)
                .with_description(
                    "An HttpResponse object with status_code <300>, "
                    "with headers: \"Hello-Dude: 'application/json'\".")
                .with_mismatch_description(
                    "Status code was: <200>. Does not contain header <Hello-Dude>.")
        )

It might, in fact, be a good idea to write a test for these matchers using these matchers.