Skip to content
/ allows Public

Easier mock configuration and assertions with Python

License

Notifications You must be signed in to change notification settings

dvndrsn/allows

Repository files navigation

Allows

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.

About

Easier mock configuration and assertions with Python

Resources

License

Stars

Watchers

Forks

Packages

No packages published