Skip to main content

Easier mock configuration and assertions in Python

Project description

Allows

https://img.shields.io/pypi/v/allows.svg https://img.shields.io/travis/dvndrsn/allows.svg Documentation Status Updates

Easier mock configuration and assertions in Python using R-spec-like grammar!

allow(my_mock).to(return_value('hi').on_method('wave'))
allow(my_mock).to(return_value('bye').on_method('wave').when_called_with('see ya'))

assert my_mock.wave() == 'hi'
assert my_mock.wave('see ya') == 'bye'

This library is built to wrap and configure Mock, MagicMock and other objects from the built in unittest.mock available in Python 3.3+.

Features

  • R-spec-like grammar for specifing Mock behavior
  • Compatible with all Python standard library unittest.mock Mock (MagicMock, Patch, etc.)
  • Stand alone SideEffect builder to model and combine complex side effects

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.1.0 (2019-05-11)

  • First release on PyPI.

Project details


Release history Release notifications

This version

0.1.0

Download files

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

Files for allows, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size allows-0.1.0-py2.py3-none-any.whl (7.1 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size allows-0.1.0.tar.gz (11.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page