Skip to main content

Python test doubles

Project description

Latest PyPI version Number of PyPI downloads

Powerful test doubles framework for Python.

design principles

  • doubles should not have public API framework methods. It avoids silent misspelling.

  • doubles do not require collaborator instances, just classes, and it never instantiate them.

  • assert_that() is used for ALL assertions.

  • invocation order for mocks is relevant by default.

  • supports old and new style classes.

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.

Project details


Download files

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

Source Distribution

doublex-1.8.1.tar.gz (34.8 kB view details)

Uploaded Source

File details

Details for the file doublex-1.8.1.tar.gz.

File metadata

  • Download URL: doublex-1.8.1.tar.gz
  • Upload date:
  • Size: 34.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for doublex-1.8.1.tar.gz
Algorithm Hash digest
SHA256 7f5ff21fbdebcff9bd490e99fc3d3d11495c86ba039ea099b6db9b282657baf6
MD5 b92d6ad03a840e26e0f7cafe1f7c99b3
BLAKE2b-256 5c5bc75b87e9fe275321dd8dac3863f09c96ec1c80f5cf160dac0522789873cd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page