Python test doubles
Powerful test doubles framework for Python
a trivial example
import unittest from doublex import Spy, assert_that, called class SpyUseExample(unittest.TestCase): def test_spy_example(self): # given spy = Spy(SomeCollaboratorClass) cut = YourClassUnderTest(spy) # when cut.a_method_that_call_the_collaborator() # then assert_that(spy.some_method, called())
See more about doublex doubles.
- doubles have not public API framework methods. It could cause silent misspelling.
- doubles do not require collaborator instances, just classes, and it never instantiate them.
- assert_that() is used for ALL assertions.
- mock invocation order is relevant by default.
- supports old and new style classes.
- supports Python versions: 2.6, 2.7, 3.3, 3.4, 3.5. 3.6, 3.7
Release history Release notifications
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size & hash||File type||Python version||Upload date|
|doublex-1.9.2.tar.gz (14.7 kB) View hashes||Source||None|