IMPORTANT: pyDoubles support is removed since version 1.9.

doublex started as a attempt to improve and simplify the codebase and API of the pyDoubles framework (by Carlos Ble).

Respect to pyDoubles, doublex has these features:

  • Just hamcrest matchers (for all features).
  • Only ProxySpy requires an instance. Other doubles accept a class too, but they never instantiate it.
  • Properties may be stubbed and spied.
  • Stub observers: Notify arbitrary hooks when methods are invoked. Useful to add “side effects”.
  • Stub delegates: Use callables, iterables or generators to create stub return values.
  • Mimic doubles: doubles that inherit the same collaborator subclasses. This provides full LSP for code that make strict type checking.

doublex solves all the issues and supports all the feature requests notified in the pyDoubles issue tracker:

And some other features requested in the user group:

doublex provides the pyDoubles API as a wrapper for easy transition to doublex for pyDoubles users. However, there are small differences. The bigger diference is that pyDoubles matchers are not supported anymore, although you may get the same feature using standard hamcrest matchers. Anyway, formally provided pyDoubles matchers are available as hamcrest aliases.

doublex supports all the pyDoubles features and some more that can not be easily backported. If you are a pyDoubles user you can run your tests using doublex.pyDoubles module. However, we recommed the native doublex API for your new developments.

In most cases the only required change in your code is the import sentence, that change from:

import pyDoubles.framework.*


from doublex.pyDoubles import *

See the old pyDoubles documentation at (that was formerly available in the site).