Fluent interface facade for Michael Foord's mock.
Project description
|Logo| |Build Status|
Fluent interface facade for Michael Foord's Mock. \* Easy and readable
configuration of mock side effects. \* Configuration and verification
using matchers.
A example test using *fluentmock* and hamcrest:
.. raw:: html
<pre><code>from fluentmock import UnitTests, when, verify
from hamcrest import assert_that, equal_to
class SeveralAnswersTests(UnitTests):
def test_should_return_configured_values_in_given_order(self):
when(targetpackage).targetfunction(2).then_return(1).then_return(2).then_return(3)
assert_that(targetpackage.targetfunction(2), equal_to(1))
assert_that(targetpackage.targetfunction(2), equal_to(2))
assert_that(targetpackage.targetfunction(2), equal_to(3))
verify(targetpackage).targetfunction(2)</code></pre>
Documentation
-------------
- `Comparing Mock and
Fluentmock <https://github.com/aelgru/fluentmock/blob/master/docs/COMPARISON.md>`__
- `Migrating from Mockito to
Fluentmock <https://github.com/aelgru/fluentmock/blob/master/docs/MIGRATION.md>`__
Motivation
----------
... was to replace mockito with something that is as powerful as Mock.
.. |Logo| image:: https://raw.github.com/aelgru/fluentmock/master/docs/fluentmock-logo.png
:target: https://pypi.python.org/pypi/fluentmock
.. |Build Status| image:: https://travis-ci.org/aelgru/fluentmock.png?branch=master
:target: https://travis-ci.org/aelgru/fluentmock
Fluent interface facade for Michael Foord's Mock. \* Easy and readable
configuration of mock side effects. \* Configuration and verification
using matchers.
A example test using *fluentmock* and hamcrest:
.. raw:: html
<pre><code>from fluentmock import UnitTests, when, verify
from hamcrest import assert_that, equal_to
class SeveralAnswersTests(UnitTests):
def test_should_return_configured_values_in_given_order(self):
when(targetpackage).targetfunction(2).then_return(1).then_return(2).then_return(3)
assert_that(targetpackage.targetfunction(2), equal_to(1))
assert_that(targetpackage.targetfunction(2), equal_to(2))
assert_that(targetpackage.targetfunction(2), equal_to(3))
verify(targetpackage).targetfunction(2)</code></pre>
Documentation
-------------
- `Comparing Mock and
Fluentmock <https://github.com/aelgru/fluentmock/blob/master/docs/COMPARISON.md>`__
- `Migrating from Mockito to
Fluentmock <https://github.com/aelgru/fluentmock/blob/master/docs/MIGRATION.md>`__
Motivation
----------
... was to replace mockito with something that is as powerful as Mock.
.. |Logo| image:: https://raw.github.com/aelgru/fluentmock/master/docs/fluentmock-logo.png
:target: https://pypi.python.org/pypi/fluentmock
.. |Build Status| image:: https://travis-ci.org/aelgru/fluentmock.png?branch=master
:target: https://travis-ci.org/aelgru/fluentmock
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for fluentmock-0.2.4-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 636c0d24f7c370590364b0b603201f6e3763a9c9ced69cbe98b68b5150b1fc62 |
|
MD5 | 21529d369010145406948cdec5d44005 |
|
BLAKE2b-256 | 955bce84f81ed61f9c141a54fe25e02d7cf537f07984ed3eed274990640f8949 |