{ "info": { "author": "Alex Gaynor", "author_email": "alex.gaynor@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Testing" ], "description": "pretend\n=======\n\n.. image:: https://secure.travis-ci.org/alex/pretend.png\n :target: https://travis-ci.org/alex/pretend\n\nPretend is a library to make stubbing with Python easier.\n\nWhat is stubbing?\n-----------------\n\nStubbing is a technique for writing tests. You may hear the term mixed up with\nmocks, fakes, or doubles. Basically a stub is an object that returns pre-canned\nresponses, rather than doing any computation.\n\nMartin Fowler does a good job explaining the terms in his `Mocks Aren't Stubs`_\narticle.\n\n.. _`Mocks Aren't Stubs`: http://martinfowler.com/articles/mocksArentStubs.html\n\nHow do I install ``pretend``?\n-----------------------------\n\nIt's easy with ``pip``!\n\n.. code:: bash\n\n $ pip install pretend\n\nHow do I use ``pretend``?\n-------------------------\n\nIt's easy, the ``stub`` function makes it easy to create a stub:\n\n.. code:: pycon\n\n >>> from pretend import stub\n >>> x = stub(country_code=\"US\")\n >>> some_function(x)\n\nHere ``x`` will be an object with a single attribute ``country_code`` which has\nthe value ``\"US\"``. Unlike mocks, ``x`` will not respond to any other attribute\nor methods, nor does it have any methods for making assertions about what you\naccessed.\n\nIf you want to add a method to the stub, simply provide a function to it:\n\n.. code:: pycon\n\n >>> from pretend import stub\n >>> x = stub(country_code=lambda: \"US\")\n >>> x.country_code()\n 'US'\n\nIt's important to note that functions on stubs *do not* take a ``self``\nargument, this is because stubs should be returning pre-canned values, not\ndoing computations.\n\nExceptions with ``pretend``\n---------------------------\n\nSometimes a method you want to stub doesn't return a value, but instead raises\nan exception. To make this easy, ``pretend`` provides a helper function,\n``raiser``, it can be used like so:\n\n.. code:: pycon\n\n >>> from pretend import stub, raiser\n >>> x = stub(func=raiser(ValueError))\n >>> x.func()\n Traceback (most recent call last):\n File \"\", line 1, in \n File \"pretend.py\", line 74, in inner\n raise exc\n ValueError\n\nWhy is stubbing better?\n-----------------------\n\nIdeally stubbing tests how your system responds to a particular input, rather\nthan which API is used. Stubbing still requires you to write tests that check\nthe results of a computation, rather than looking for side effects. This\ndoesn't always work though, so you do sometimes still need mocking (e.g.\nsometimes you really want to check for a side effect.)\n\nHow do I get my stub into place?\n--------------------------------\n\nIf you come from other mocking libraries you're probably used to a ``patch``\nmethod to put a mock in place. ``pretend`` doesn't include anything like this,\na) we believe it's better, where possible, to pass stubs as arguments rather\nthan monkey patch them into place, b) we believe that when you do need to\nmonkey patch something into place you should use something provided by your\ntesting tool. ``py.test`` includes `such a tool`_.\n\n.. _`such a tool`: http://pytest.org/latest/monkeypatch.html\n\nWhat if I really need to record the calls?\n------------------------------------------\n\nIf you really really need to, ``pretend`` includes a ``call_recorder`` utility:\n\n.. code:: pycon\n\n >>> from pretend import call_recorder, call\n >>> f = call_recorder(lambda a: a + 2)\n >>> f(3)\n 5\n >>> assert f.calls == [call(3)]\n\nWho wrote this?\n---------------\n\n``pretend`` is by Alex Gaynor, who was just tired of not having a good stubbing\ntool for Python. The name is from Idan Gazit.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/alex/pretend", "keywords": "", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "pretend", "package_url": "https://pypi.org/project/pretend/", "platform": "", "project_url": "https://pypi.org/project/pretend/", "project_urls": { "Homepage": "https://github.com/alex/pretend" }, "release_url": "https://pypi.org/project/pretend/1.0.9/", "requires_dist": null, "requires_python": "", "summary": "A library for stubbing in Python", "version": "1.0.9" }, "last_serial": 3764473, "releases": { "0.5": [ { "comment_text": "", "digests": { "md5": "d4671e38bc6874c17115e3d5f97d547a", "sha256": "6887029f29eb46a02aa4738ccdea3855d37bea85df49ff750e4390f996e78fe5" }, "downloads": -1, "filename": "pretend-0.5.tar.gz", "has_sig": false, "md5_digest": "d4671e38bc6874c17115e3d5f97d547a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2440, "upload_time": "2012-11-08T15:13:32", "url": "https://files.pythonhosted.org/packages/17/29/d053f6e00cf5fb767fa785aeabf079b6f60033c195ba1dbc2dfe6e5bf835/pretend-0.5.tar.gz" } ], "0.6": [ { "comment_text": "", "digests": { "md5": "0d7462a69269436ff53e9e09af93e01d", "sha256": "68f85cfabd54df091775f8c955c8dfebb17e19a6f53892c8961c618331cb09e7" }, "downloads": -1, "filename": "pretend-0.6.tar.gz", "has_sig": false, "md5_digest": "0d7462a69269436ff53e9e09af93e01d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2652, "upload_time": "2012-11-20T18:02:03", "url": "https://files.pythonhosted.org/packages/dd/32/f0613d43ba596f3b4ed8dd32dbff96b470f668a2d0dc491f71c3a5967129/pretend-0.6.tar.gz" } ], "0.7": [ { "comment_text": "", "digests": { "md5": "83bb1df15571098d89a074966735f6ee", "sha256": "c3affb40ebb4e262e0304d41d8593a36dff7a250bfe10148f37b60ae5f2b2e7a" }, "downloads": -1, "filename": "pretend-0.7.tar.gz", "has_sig": false, "md5_digest": "83bb1df15571098d89a074966735f6ee", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3014, "upload_time": "2013-02-08T08:02:59", "url": "https://files.pythonhosted.org/packages/d8/fc/2791334b96ec2baa558c7bd09786a81cd1e8398a61602e2411afcaace1c9/pretend-0.7.tar.gz" } ], "1.0": [ { "comment_text": "", "digests": { "md5": "364eb9172073a657d2ebe18e1277abac", "sha256": "6b6c135135978352c707f86f2aaaacebf6242570bcb98f61ad720ce9fcba4eca" }, "downloads": -1, "filename": "pretend-1.0.tar.gz", "has_sig": false, "md5_digest": "364eb9172073a657d2ebe18e1277abac", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3425, "upload_time": "2013-07-29T17:56:37", "url": "https://files.pythonhosted.org/packages/eb/1f/27c65d5d47c79be69300f76439d59b71857219afba5592226a5b75441102/pretend-1.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "24c3d20b3be957c4191196be5feb0e85", "sha256": "fa3d1612a89f7901c0e2bfb9a054e5cc86348a90dc46d921c29f7b44d1691bc8" }, "downloads": -1, "filename": "pretend-1.0.1.tar.gz", "has_sig": true, "md5_digest": "24c3d20b3be957c4191196be5feb0e85", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3524, "upload_time": "2013-07-29T18:07:17", "url": "https://files.pythonhosted.org/packages/86/b3/96c50adf528151a6e9691fda46e414a04122639494616506348e8358fd52/pretend-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "ab390015de9d8c1093bd48d85fb231c0", "sha256": "3d4d9ab24fb2d6e7a97b4ebe219bec31a7a1d89e3067d838e0aa5bf60e6cc367" }, "downloads": -1, "filename": "pretend-1.0.2-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "ab390015de9d8c1093bd48d85fb231c0", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 6045, "upload_time": "2013-07-29T18:12:41", "url": "https://files.pythonhosted.org/packages/c2/46/dbd12f7820cdd70756767e3b52c137ce4be8071d8afa32876201667b89ba/pretend-1.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "65a05050db0aa965abf4a1e08c8c0379", "sha256": "03f3779644a340c4eae1c72dfa9ad83d633ccd47397926065b27997ffd41fe86" }, "downloads": -1, "filename": "pretend-1.0.2.tar.gz", "has_sig": true, "md5_digest": "65a05050db0aa965abf4a1e08c8c0379", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3835, "upload_time": "2013-07-29T18:12:29", "url": "https://files.pythonhosted.org/packages/4f/60/2c36bd11946d0cc9465a1b36926034c47684879981a1b6eb1775dc7ff44b/pretend-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "6700e572a81ad34c5b5e1edc00b2cdf8", "sha256": "6949e7b3355a00b9a6368e229c3fc3a72bb0447a983b450d601b30dc9c7be3ab" }, "downloads": -1, "filename": "pretend-1.0.3-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "6700e572a81ad34c5b5e1edc00b2cdf8", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 6067, "upload_time": "2013-08-04T18:39:42", "url": "https://files.pythonhosted.org/packages/12/d8/ec5c97b9f8af23f4ed0a48bcc09baf28c6e84a6793080b86ad0fcacd32b3/pretend-1.0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "894f58350d18918c16dc4f2aa0822a07", "sha256": "26822495076b323f78e5939bb8ac620c4ceec6de75eead38886b9a552d962994" }, "downloads": -1, "filename": "pretend-1.0.3.tar.gz", "has_sig": true, "md5_digest": "894f58350d18918c16dc4f2aa0822a07", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3863, "upload_time": "2013-08-04T18:39:22", "url": "https://files.pythonhosted.org/packages/6b/61/840fdc34994bbc4408fa3648c639ae728fb2af9f1583aa0c5f7740480b69/pretend-1.0.3.tar.gz" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "a20e72c52b0ab1814570cc4d6645a7ae", "sha256": "134dde73e4b0763e7a8fdfe9de409217356e60de1d84a332b000b6c83022d8b7" }, "downloads": -1, "filename": "pretend-1.0.4.tar.gz", "has_sig": false, "md5_digest": "a20e72c52b0ab1814570cc4d6645a7ae", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4761, "upload_time": "2013-08-12T18:22:34", "url": "https://files.pythonhosted.org/packages/d5/f6/f1e0767498e3e15f4d6ac1d305cc74e44664002eca792660abbe4675e588/pretend-1.0.4.tar.gz" } ], "1.0.5": [ { "comment_text": "", "digests": { "md5": "89067293447c13c8b1101fc826487de6", "sha256": "b931cb2059a062e52ab69fa8438cfe9904e16e2f43b19573b6348a2d65066618" }, "downloads": -1, "filename": "pretend-1.0.5-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "89067293447c13c8b1101fc826487de6", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 6067, "upload_time": "2013-08-12T18:29:12", "url": "https://files.pythonhosted.org/packages/29/89/ab9775b40ac6620549832e9785ad11981fdc732a783511fc1486b61eab2a/pretend-1.0.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4892d193c90102b0c2ffc3d9d4f8c7cb", "sha256": "e31a2a513a23bb0973f724f172383e9a1e1b12bc0928fcaad58f6b5cd2b426b8" }, "downloads": -1, "filename": "pretend-1.0.5.tar.gz", "has_sig": true, "md5_digest": "4892d193c90102b0c2ffc3d9d4f8c7cb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4763, "upload_time": "2013-08-12T18:28:57", "url": "https://files.pythonhosted.org/packages/7a/df/ff9f4c78717f8c0527125e9f65698f8dde0b5be912300093addf086511be/pretend-1.0.5.tar.gz" } ], "1.0.6": [ { "comment_text": "", "digests": { "md5": "fcf552c3e80b4e6e8e785aeea8a00036", "sha256": "78f18ba7c491180b4cf44f68e31d912323669675512032a53f2a41bd7028972f" }, "downloads": -1, "filename": "pretend-1.0.6-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "fcf552c3e80b4e6e8e785aeea8a00036", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 6101, "upload_time": "2013-09-30T06:37:38", "url": "https://files.pythonhosted.org/packages/3f/2c/a9e1a4f78005648235b992f8039a513fe34d23c9c4f86c58d58ad1275a63/pretend-1.0.6-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "80eeaed8b424c6d1519bdf7750485871", "sha256": "0a599862b556561eac81e873c80cb2238212e1a628a8d4bf6fc173b2884f707c" }, "downloads": -1, "filename": "pretend-1.0.6.tar.gz", "has_sig": true, "md5_digest": "80eeaed8b424c6d1519bdf7750485871", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4791, "upload_time": "2013-09-30T06:37:21", "url": "https://files.pythonhosted.org/packages/f9/e3/353b57311928bb609788188fe4ba0187b5c6cbe8c1f03d7c96ee9dda9e17/pretend-1.0.6.tar.gz" } ], "1.0.7": [ { "comment_text": "", "digests": { "md5": "f71dfaebe9bc3da1099667e45e02ac54", "sha256": "f6c3686042d5fc459105cf336476f82bf7f6abbcc16c03b3ce2b73abb62767fd" }, "downloads": -1, "filename": "pretend-1.0.7-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "f71dfaebe9bc3da1099667e45e02ac54", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 6107, "upload_time": "2014-01-01T22:44:26", "url": "https://files.pythonhosted.org/packages/19/e8/fb1820d67f5d9712cb850dd40f4a28483ea05925b25a98ba0ab32f0cd6bd/pretend-1.0.7-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "32baa98398931dabafa2a3fd5513575d", "sha256": "306906ea041a41ba23171aaf82112b49c516edbb08a29c8d0f113ee5def86d19" }, "downloads": -1, "filename": "pretend-1.0.7.tar.gz", "has_sig": true, "md5_digest": "32baa98398931dabafa2a3fd5513575d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4788, "upload_time": "2014-01-01T22:44:20", "url": "https://files.pythonhosted.org/packages/48/85/42eb568b66f7a3d8671151f7af0b0eaf9d90831b0c064f1c63c361610f0d/pretend-1.0.7.tar.gz" } ], "1.0.8": [ { "comment_text": "", "digests": { "md5": "de39ac147c131b67655e4990db8f56b7", "sha256": "a05f1d5eefad9f1b5471795d993e2e3ee25ebb82c273ca461710ed04d22dc07f" }, "downloads": -1, "filename": "pretend-1.0.8-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "de39ac147c131b67655e4990db8f56b7", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6165, "upload_time": "2014-03-08T22:31:48", "url": "https://files.pythonhosted.org/packages/7b/f2/9a61ff0bfa6827ed4f5228327bc636d00fa631566050d767976dd1402578/pretend-1.0.8-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7147050a95c9f494248557b42b58ad79", "sha256": "930f2c1e18503e8f8c403abe2e02166c4a881941745147e712cdd4f49f3fb964" }, "downloads": -1, "filename": "pretend-1.0.8.tar.gz", "has_sig": true, "md5_digest": "7147050a95c9f494248557b42b58ad79", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4848, "upload_time": "2014-03-08T22:32:07", "url": "https://files.pythonhosted.org/packages/49/4c/ce9218b1e7c1e3dcea38b3ff287c240d38e985ba622297f1f5cf6a136bc3/pretend-1.0.8.tar.gz" } ], "1.0.9": [ { "comment_text": "", "digests": { "md5": "aaba76920da59aabf025a89cc515e1c7", "sha256": "e389b12b7073604be67845dbe32bf8297360ad9a609b24846fe15d86e0b7dc01" }, "downloads": -1, "filename": "pretend-1.0.9-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "aaba76920da59aabf025a89cc515e1c7", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 3848, "upload_time": "2018-04-14T14:31:04", "url": "https://files.pythonhosted.org/packages/49/1f/3d4f0579913edd3ad5b23ad52fcc42531cb736ad52af2ba6c057da8785b6/pretend-1.0.9-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ad53883ede48aeac7ae584f0de0240e8", "sha256": "c90eb810cde8ebb06dafcb8796f9a95228ce796531bc806e794c2f4649aa1b10" }, "downloads": -1, "filename": "pretend-1.0.9.tar.gz", "has_sig": true, "md5_digest": "ad53883ede48aeac7ae584f0de0240e8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4848, "upload_time": "2018-04-14T14:31:08", "url": "https://files.pythonhosted.org/packages/3c/f8/7c86fd40c9e83deb10891a60d2dcb1af0b3b38064d72ebdb12486acc824f/pretend-1.0.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "aaba76920da59aabf025a89cc515e1c7", "sha256": "e389b12b7073604be67845dbe32bf8297360ad9a609b24846fe15d86e0b7dc01" }, "downloads": -1, "filename": "pretend-1.0.9-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "aaba76920da59aabf025a89cc515e1c7", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 3848, "upload_time": "2018-04-14T14:31:04", "url": "https://files.pythonhosted.org/packages/49/1f/3d4f0579913edd3ad5b23ad52fcc42531cb736ad52af2ba6c057da8785b6/pretend-1.0.9-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ad53883ede48aeac7ae584f0de0240e8", "sha256": "c90eb810cde8ebb06dafcb8796f9a95228ce796531bc806e794c2f4649aa1b10" }, "downloads": -1, "filename": "pretend-1.0.9.tar.gz", "has_sig": true, "md5_digest": "ad53883ede48aeac7ae584f0de0240e8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4848, "upload_time": "2018-04-14T14:31:08", "url": "https://files.pythonhosted.org/packages/3c/f8/7c86fd40c9e83deb10891a60d2dcb1af0b3b38064d72ebdb12486acc824f/pretend-1.0.9.tar.gz" } ] }