Skip to main content

hamcrest matchers for mock assertions

Project description

pypi license

mock.matchers simply makes PyHamcrest matchers usable with the mock assertion calls.

Examples:

from mock import Mock
import mock_matchers

m = Mock()
m.foo(1,2,3)
m.bar([1,2,3])

m.foo.assert_called_with(
    mock_matchers.instance_of(int),
    mock_matchers.instance_of(int),
    3
)
m.foo.assert_called_with(
    [
                    mock_matchers.instance_of(int),
                    2,
                    3
    ]
)
m.foo.assert_called_with(mock_matchers.isntance_of(list))

etc… For a full list of available matchers refer to the PyHamcrest Matchers documentation and simply replace from hamcrest import <name_of_matcher> with from mock_matchers import <name_of_matcher>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mock_matchers-0.0.1.tar.gz (9.3 kB view hashes)

Uploaded Source

Built Distribution

mock_matchers-0.0.1-py2.7.egg (9.5 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page