Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Easy creation of hamcrest matchers

Project Description

Decorators that simplify the creation of Hamcrest matchers.

From a function (with an optional appropriate docstring), create hamcrest matchers with minimum extra coding.

The sources can be found in GitHub.

Examples:

from matchmaker import matcher

@matcher
def is_even(item):
    return item % 2 == 0

@matcher
def ends_like(item, data, length=3):
    "String whose last {1} chars match those for '{0}'"
    return item.endswith(data[-length:])

You can then use these in your tests as:

assert_that(number, is_even())
assert_that(word, ends_like(other_word, 4))

Errors will display as:

AssertionError:
Expected: Is even
     but: was <3>

AssertionError:
Expected: String whose last 4 chars match those for 'cello'
     but: was 'hullo'
Release History

Release History

This version
History Node

0.1.3

History Node

0.1.2

History Node

0.1.1

History Node

0.1.0

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
matchmaker-0.1.3-py2-none-any.whl (3.9 kB) Copy SHA256 Checksum SHA256 2.7 Wheel Sep 18, 2014
matchmaker-0.1.3.tar.gz (2.1 kB) Copy SHA256 Checksum SHA256 Source Jul 5, 2013

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting