{ "info": { "author": "Wim Glenn", "author_email": "hey@wimglenn.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Software Development :: Libraries" ], "description": "Copying Mock\n============\n\n|travis|_ |coveralls|_ |pypi|_ |pyversions|_ |womm|_\n\n.. |travis| image:: https://img.shields.io/travis/wimglenn/copyingmock.svg?branch=master\n.. _travis: https://travis-ci.org/wimglenn/copyingmock\n\n.. |coveralls| image:: https://img.shields.io/coveralls/wimglenn/copyingmock.svg\n.. _coveralls: https://coveralls.io/github/wimglenn/copyingmock?branch=master\n\n.. |pypi| image:: https://img.shields.io/pypi/v/copyingmock.svg\n.. _pypi: https://pypi.python.org/pypi/copyingmock\n\n.. |pyversions| image:: https://img.shields.io/pypi/pyversions/copyingmock.svg\n.. _pyversions: \n\n.. |womm| image:: https://cdn.rawgit.com/nikku/works-on-my-machine/v0.2.0/badge.svg\n.. _womm: https://github.com/nikku/works-on-my-machine\n\n\n``MagicMock`` has problems when used on a function with mutable arguments. This is called out in the `documentation `_:\n\n Another situation is rare, but can bite you, is when your mock is called with mutable arguments. ``call_args`` and ``call_args_list`` store references to the arguments. If the arguments are mutated by the code under test then you can no longer make assertions about what the values were when the mock was called.\n\nThey then go on to propose a workaround, using ``side_effect``, but it's not very likable. There is also an elegant recipe offered which copies arguments at call-time. It's simply a subclass of ``MagicMock`` which copies the arguments, instead of storing references. I'm not sure why the recipe wasn't included directly in ``mock``, so here it is as a third-party package. \n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/wimglenn/copyingmock", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "copyingmock", "package_url": "https://pypi.org/project/copyingmock/", "platform": "", "project_url": "https://pypi.org/project/copyingmock/", "project_urls": { "Homepage": "https://github.com/wimglenn/copyingmock" }, "release_url": "https://pypi.org/project/copyingmock/0.2/", "requires_dist": [ "mock; python_version < \"3.3\"" ], "requires_python": "", "summary": "A subclass of MagicMock that copies the arguments", "version": "0.2" }, "last_serial": 3613422, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "f0fb4ec764cb416e3e25aba1ccfb4463", "sha256": "cbc0bec0ffeff007aa15c6efcfc42ff66fbbb4dfc4a1db123b80acd0f3455581" }, "downloads": -1, "filename": "copyingmock-0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f0fb4ec764cb416e3e25aba1ccfb4463", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4531, "upload_time": "2017-01-05T03:29:31", "url": "https://files.pythonhosted.org/packages/d9/26/5ae8945356634c87cdf099bd7cee57799df46798af90ae5ccb03961c6359/copyingmock-0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0c1bf27d003aaaa06cd74b47fd7ac55f", "sha256": "02f2fee6c3666deffad9940ee23874cbed25c6ffef96e24b5c32ccad2e208c5f" }, "downloads": -1, "filename": "copyingmock-0.1.tar.gz", "has_sig": false, "md5_digest": "0c1bf27d003aaaa06cd74b47fd7ac55f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1939, "upload_time": "2017-01-05T03:29:33", "url": "https://files.pythonhosted.org/packages/a1/87/be0f6cbee9c455c4472caad6637e426b4a192d58f808721a6d5f9af8fe67/copyingmock-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "497a0aaeb057481e16d6fae6ea281932", "sha256": "b8496586ab6f91af8d751ffd28c34a8b7ebe8058c4113d74d6521c6d35ec311f" }, "downloads": -1, "filename": "copyingmock-0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "497a0aaeb057481e16d6fae6ea281932", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 3840, "upload_time": "2018-02-25T03:03:14", "url": "https://files.pythonhosted.org/packages/5e/8e/3b2f4e29f918759216f1d6c3b42e8b128f3b01d492046bcf45eb4b907e17/copyingmock-0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9aa6ba13542d25e527fe358d53cdaf3b", "sha256": "fa4c8aad336f6e74f7632f40ff5a271130be5def44ab3177af4578c4d4a66093" }, "downloads": -1, "filename": "copyingmock-0.2.tar.gz", "has_sig": false, "md5_digest": "9aa6ba13542d25e527fe358d53cdaf3b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2044, "upload_time": "2018-02-25T03:03:15", "url": "https://files.pythonhosted.org/packages/e7/4b/857c745721ed3d5dc33c426d6e31aaff13a5cd5caaf444117139b2d9936f/copyingmock-0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "497a0aaeb057481e16d6fae6ea281932", "sha256": "b8496586ab6f91af8d751ffd28c34a8b7ebe8058c4113d74d6521c6d35ec311f" }, "downloads": -1, "filename": "copyingmock-0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "497a0aaeb057481e16d6fae6ea281932", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 3840, "upload_time": "2018-02-25T03:03:14", "url": "https://files.pythonhosted.org/packages/5e/8e/3b2f4e29f918759216f1d6c3b42e8b128f3b01d492046bcf45eb4b907e17/copyingmock-0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9aa6ba13542d25e527fe358d53cdaf3b", "sha256": "fa4c8aad336f6e74f7632f40ff5a271130be5def44ab3177af4578c4d4a66093" }, "downloads": -1, "filename": "copyingmock-0.2.tar.gz", "has_sig": false, "md5_digest": "9aa6ba13542d25e527fe358d53cdaf3b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2044, "upload_time": "2018-02-25T03:03:15", "url": "https://files.pythonhosted.org/packages/e7/4b/857c745721ed3d5dc33c426d6e31aaff13a5cd5caaf444117139b2d9936f/copyingmock-0.2.tar.gz" } ] }