Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

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.

Files for mock_matchers, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size mock_matchers-0.0.1-py2.7.egg (9.5 kB) File type Egg Python version 2.7 Upload date Hashes View
Filename, size mock_matchers-0.0.1.tar.gz (9.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page