{ "info": { "author": "Benoit Bernard", "author_email": "aGlAYmVuYmVybmFyZGJsb2cuY29t@base64.email", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy" ], "description": "code-contracts: Contracts and Assertions for Python\n===================================================\n\n**code-contracts** is a library that provides:\n\n1. **Contracts**\n Functions that impose requirements when entering a function or method - also commonly called *preconditions*.\n2. **Assertions**\n Functions that impose requirements in the body of a function or method. This is not a complete suite of assertions;\n instead, they are meant to be complementary to those available in `unittest.TestCase`.\n\nThe goal of this library is not to make Python a statically-typed language. Instead, it aims to help you define what\nis expected from your code before it executes, so that you can more easily track and prevent bugs.\n\nSo here's how you can use contracts:\n\n.. code-block:: python\n\n from contracts import contract\n\n\n def build_rocket(name, model, company):\n contract.is_not_empty(name)\n contract.is_greater_than(model, 0)\n contract.is_not_empty(company)\n\n print(\"You built a {0} {1} rocket from {2}.\".format(name, model, company))\n\n if __name__ == \"__main__\":\n build_rocket(\"Falcon\", 9, \"SpaceX\")\n\nAnd here's how you can use assertions to unit test the above function:\n\n.. code-block:: python\n\n import unittest\n from contracts import assertion\n\n\n class RocketTests(unittest.TestCase):\n def test_build_rocket(self):\n assertion.does_not_raise(ValueError, build_rocket, \"Falcon\", 9, \"SpaceX\")\n\n**code-contracts** officially supports Python 3.3 and onwards.\n\nInstallation\n------------\n\nSimply run the following command in your favorite terminal:\n\n.. code-block:: bash\n\n $ pip install code-contracts\n\nDocumentation\n-------------\n\nThe full documentation is available at http://contracts.readthedocs.io/.\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/mbenbernard/contracts", "keywords": "", "license": "Apache 2.0", "maintainer": "", "maintainer_email": "", "name": "code-contracts", "package_url": "https://pypi.org/project/code-contracts/", "platform": "", "project_url": "https://pypi.org/project/code-contracts/", "project_urls": { "Homepage": "https://github.com/mbenbernard/contracts" }, "release_url": "https://pypi.org/project/code-contracts/0.1.1/", "requires_dist": null, "requires_python": "~=3.3", "summary": "A library that provides code contracts and assertions.", "version": "0.1.1" }, "last_serial": 3136312, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "1fb5acec4a5ebd6c97fe031304dfd913", "sha256": "a28e08b2a089c7bcfb771600ce5ffa55157e42b5c8494901ba60e7419ee4dfd2" }, "downloads": -1, "filename": "code_contracts-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "1fb5acec4a5ebd6c97fe031304dfd913", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.3", "size": 7656, "upload_time": "2017-08-30T17:56:33", "url": "https://files.pythonhosted.org/packages/ac/53/c7a43f239103fae7772bddd8d954c3afaa403cd5547242de2607a1bc31fc/code_contracts-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ac165200ced5f97301970a5ffb3a6769", "sha256": "9a7199366c2bb1884572745d07809e7e92ba461c9ba4505868e7435d5cc84785" }, "downloads": -1, "filename": "code-contracts-0.1.0.tar.gz", "has_sig": false, "md5_digest": "ac165200ced5f97301970a5ffb3a6769", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.3", "size": 5566, "upload_time": "2017-08-30T17:56:34", "url": "https://files.pythonhosted.org/packages/1b/e1/390b883fd897c296cda310df2579d1ba30e95b0039752444b5b8975b58bd/code-contracts-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "08c98258a4c64ab9c6dcdfa28c8bd9fa", "sha256": "127091b03c3a58c155d034a57ad5eade105598340d49f42c764abc612667a2d6" }, "downloads": -1, "filename": "code_contracts-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "08c98258a4c64ab9c6dcdfa28c8bd9fa", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.3", "size": 7662, "upload_time": "2017-08-31T00:31:48", "url": "https://files.pythonhosted.org/packages/0f/84/b8f13edc5506d85fd013ac0de08befe0b88980810a9639a44b4edb6f1fab/code_contracts-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d2f65ba937251ba631586cf5833ccd28", "sha256": "d3682eb82fa7084a4db287cce9219170105dda52b00a3196e19fd1b61b4a278f" }, "downloads": -1, "filename": "code-contracts-0.1.1.tar.gz", "has_sig": false, "md5_digest": "d2f65ba937251ba631586cf5833ccd28", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.3", "size": 5577, "upload_time": "2017-08-31T00:31:50", "url": "https://files.pythonhosted.org/packages/5d/40/a18f6b363712419292b19f8d119a2690447333c3d8e4515c99801414639e/code-contracts-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "08c98258a4c64ab9c6dcdfa28c8bd9fa", "sha256": "127091b03c3a58c155d034a57ad5eade105598340d49f42c764abc612667a2d6" }, "downloads": -1, "filename": "code_contracts-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "08c98258a4c64ab9c6dcdfa28c8bd9fa", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.3", "size": 7662, "upload_time": "2017-08-31T00:31:48", "url": "https://files.pythonhosted.org/packages/0f/84/b8f13edc5506d85fd013ac0de08befe0b88980810a9639a44b4edb6f1fab/code_contracts-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d2f65ba937251ba631586cf5833ccd28", "sha256": "d3682eb82fa7084a4db287cce9219170105dda52b00a3196e19fd1b61b4a278f" }, "downloads": -1, "filename": "code-contracts-0.1.1.tar.gz", "has_sig": false, "md5_digest": "d2f65ba937251ba631586cf5833ccd28", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.3", "size": 5577, "upload_time": "2017-08-31T00:31:50", "url": "https://files.pythonhosted.org/packages/5d/40/a18f6b363712419292b19f8d119a2690447333c3d8e4515c99801414639e/code-contracts-0.1.1.tar.gz" } ] }