ExpectTerse mock expectations for Python and Mock | |
Download |
Expect Ranking & Summary
Advertisement
- License:
- MIT/X Consortium Lic...
- Price:
- FREE
- Publisher Name:
- Sumeet Agarwal
- Publisher web site:
- http://github.com/sumeet/
Expect Tags
Expect Description
expect is a Python module inspired by RSpec's test doubles and Expecter Gadget.Uses Mock but provides a terser syntax for expectations.Example:>>> def assert_equal(lhs, rhs):... assert lhs == rhs>>> from expect import new_expect>>> expect = new_expect(__eq__=assert_equal)>>> expect(2) == 2>>> expect(2) == 3Traceback (most recent call last): ...AssertionError>>> class MyClass(object):... @classmethod... def my_method(cls, arg):... pass>>> # Stubs don't have to be called.>>> expect(MyClass).stub('my_method').with_(1).and_return(2)>>> MyClass.my_method(1)2>>> expect.reset()>>> # Mocks>>> expect(MyClass).should_receive('my_method').with_(1).and_return(2)>>> expect.verify()Traceback (most recent call last): ...AssertionError: Expected to be called once. Called 0 times.Product's homepage
Expect Related Software