Skip to main content

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 files for matchmaker 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for matchmaker 0.1.4
File Size Uploaded
matchmaker-0.1.4.tar.gz 2.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for matchmaker 0.1.4
File Interpreter ABI Platform
matchmaker-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size:5.3 kB

Release files / matchmaker-0.1.4.tar.gz

Download URL matchmaker-0.1.4.tar.gz
Size 2.7 kB
Tags Source
SHA-256 checksum
How to use checksums
847f78a9177c114e9d008c2e2d019fb1d747bc73b6b3aadefc0f91aa12d69e76
BLAKE2b-256 checksum
How to use checksums
9740b5a4e3603ec5649e475caa831e9f166ff290c490bce26ef39deb89be2f0d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.8

Release files / matchmaker-0.1.4-py3-none-any.whl

Download URL matchmaker-0.1.4-py3-none-any.whl
Size 2.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
44488da450f2e5e972b5deeee34da3947346e4bea33866d12486f812953b49d4
BLAKE2b-256 checksum
How to use checksums
7090fd63456706e3317ddd85b05f69ff8c93a9b3936bfb3cfc05af50c7854c23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.8

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page