matchmaker 0.1.3

Easy creation of hamcrest matchers
matchmaker provides 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'

last updated on:
February 27th, 2012, 13:40 GMT
price:
FREE!
homepage:
github.com
license type:
LGPL (GNU Lesser General Public License) 
developed by:
Carles Barrobes
category:
ROOT \ Programming \ Quality Assurance and Testing
matchmaker
Download Button

In a hurry? Add it to your Download Basket!

user rating

UNRATED
0.0/5
 

0/5

Rate it!

Add your review!

SUBMIT