{ "info": { "author": "Maxim Kulkin", "author_email": "maxim.kulkin@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "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": "*******************\r\nlollipop-hypothesis\r\n*******************\r\n\r\n.. image:: https://img.shields.io/pypi/l/lollipop-hypothesis.svg\r\n :target: https://github.com/maximkulkin/lollipop-hypothesis/blob/master/LICENSE\r\n :alt: License: MIT\r\n\r\n.. image:: https://img.shields.io/travis/maximkulkin/lollipop-hypothesis.svg\r\n :target: https://travis-ci.org/maximkulkin/lollipop-hypothesis\r\n :alt: Build Status\r\n\r\n.. image:: https://img.shields.io/pypi/v/lollipop-hypothesis.svg\r\n :target: https://pypi.python.org/pypi/lollipop-hypothesis\r\n :alt: PyPI\r\n\r\nLibrary to generate random test data using Hypothesis based on Lollipop schema.\r\n\r\nExample\r\n=======\r\n.. code:: python\r\n\r\n from collections import namedtuple\r\n import lollipop.types as lt\r\n import lollipop.validators as lv\r\n import string\r\n\r\n EMAIL_REGEXP = r\"^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]{2,}\\.[a-zA-Z0-9-.]{2,}$\"\r\n Email = lt.validated_type(lt.String, 'Email', lv.Regexp(EMAIL_REGEXP))\r\n\r\n User = namedtuple('User', ['name', 'email', 'age'])\r\n\r\n USER = lt.Object({\r\n 'name': lt.String(validate=lv.Length(min=1)),\r\n 'email': Email(),\r\n 'age': lt.Optional(lt.Integer(validate=lv.Range(min=18))),\r\n }, constructor=User)\r\n\r\n import hypothesis as h\r\n import hypothesis.strategies as hs\r\n import lollipop_hypothesis as lh\r\n\r\n # Write a test using data generation strategy based on Lollipop schema\r\n @h.given(lh.type_strategy(USER))\r\n def test_can_register_any_valid_user(user):\r\n register(user)\r\n\r\n # Configure custom strategy for Email type\r\n lh.register(\r\n Email,\r\n lambda _, type, context=None: \\\r\n hs.tuples(\r\n hs.text('abcdefghijklmnopqrstuvwxyz'\r\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'\r\n '0123456789'\r\n '_.+-', min_size=1),\r\n hs.lists(\r\n hs.text('abcdefghijklmnopqrstuvwxyz'\r\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'\r\n '0123456789', min_size=2),\r\n min_size=2,\r\n average_size=3,\r\n )\r\n ).map(lambda (name, domain_parts): name + '@' + '.'.join(domain_parts)),\r\n )\r\n\r\n # Or configure custom strategy for the whole type instance\r\n lh.register(\r\n USER,\r\n lambda registry, type, context=None: \\\r\n hs.builds(\r\n User,\r\n name=hs.text(min_size=1),\r\n email=registry.convert(Email(), context),\r\n age=hs.integers(min_value=0, max_value=100),\r\n )\r\n )\r\n\r\n\r\nInstallation\r\n============\r\n::\r\n\r\n $ pip install lollipop-hypothesis\r\n\r\n # install optional package for regex support\r\n $ pip install lollipop-hypothesis[regex]\r\n\r\nRequirements\r\n============\r\n\r\n- Python >= 2.7 and <= 3.6\r\n- `lollipop `_ >= 1.1.3\r\n- `hypothesis `_ >= 3.8\r\n- (optional) `hypothesis-regex `_ >= 0.1\r\n\r\nProject Links\r\n=============\r\n\r\n- PyPI: https://pypi.python.org/pypi/lollipop-hypothesis\r\n- Issues: https://github.com/maximkulkin/lollipop-hypothesis/issues\r\n\r\nLicense\r\n=======\r\n\r\nMIT licensed. See the bundled `LICENSE `_ file for more details.", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/maximkulkin/lollipop-hypothesis", "keywords": "lollipop,hypothesis", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "lollipop-hypothesis", "package_url": "https://pypi.org/project/lollipop-hypothesis/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/lollipop-hypothesis/", "project_urls": { "Homepage": "https://github.com/maximkulkin/lollipop-hypothesis" }, "release_url": "https://pypi.org/project/lollipop-hypothesis/0.2/", "requires_dist": [ "hypothesis (>=3.8)", "hypothesis[datetime]", "lollipop (>=1.1.3)", "six (>=1.10)", "hypothesis-regex; extra == 'regex'" ], "requires_python": "", "summary": "Library to generate random test data using Hypothesis based on Lollipop schema", "version": "0.2" }, "last_serial": 2877444, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "078ef78ecac4feead2911f5a44a085c3", "sha256": "722bc1d7635b8efa701ef2072cbcf31e37adcea688f10961e0ab00bbea2d54ba" }, "downloads": -1, "filename": "lollipop_hypothesis-0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "078ef78ecac4feead2911f5a44a085c3", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6615, "upload_time": "2017-05-12T00:39:07", "url": "https://files.pythonhosted.org/packages/c6/64/744785ee99e6a16d8abf8093c4956f7f1c64ebe0c157ad7a3fc6e17504cb/lollipop_hypothesis-0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6cf25f17ac097585930bf326bc2f903e", "sha256": "c19be9816424eb9c75b737d3b5282b5449b86815da86c69a7cc5831157194f2c" }, "downloads": -1, "filename": "lollipop-hypothesis-0.1.tar.gz", "has_sig": false, "md5_digest": "6cf25f17ac097585930bf326bc2f903e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9205, "upload_time": "2017-05-12T00:39:09", "url": "https://files.pythonhosted.org/packages/99/2a/0d2f4595d7803c4bdb47b691cd6832f8d42f125ffe3f2a1175ded0bdd5be/lollipop-hypothesis-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "69eb89e51151b8a70a2b6205cf77bce1", "sha256": "4f97297fbd7d86cb8c814f42535389a8743b43c84b20497465c3b8448bd6e039" }, "downloads": -1, "filename": "lollipop_hypothesis-0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "69eb89e51151b8a70a2b6205cf77bce1", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7140, "upload_time": "2017-05-16T07:06:34", "url": "https://files.pythonhosted.org/packages/d2/23/3b7b5cc5ab64cc096c4bcc61e15b7a91d14ba14f0d9f95267a1074a9eeda/lollipop_hypothesis-0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3be38f4bcc9c1220a2e7a2e77b70df04", "sha256": "0d8297a89e486037e0908b6dfe7ed1b4475a5642d2cbc48552a174d9a22d9ad1" }, "downloads": -1, "filename": "lollipop-hypothesis-0.2.tar.gz", "has_sig": false, "md5_digest": "3be38f4bcc9c1220a2e7a2e77b70df04", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7183, "upload_time": "2017-05-16T07:06:36", "url": "https://files.pythonhosted.org/packages/30/59/1c7e8f0db3ae2437db3bcca96e18beebaf3d8f1900ca9587ec72e70a42e6/lollipop-hypothesis-0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "69eb89e51151b8a70a2b6205cf77bce1", "sha256": "4f97297fbd7d86cb8c814f42535389a8743b43c84b20497465c3b8448bd6e039" }, "downloads": -1, "filename": "lollipop_hypothesis-0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "69eb89e51151b8a70a2b6205cf77bce1", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7140, "upload_time": "2017-05-16T07:06:34", "url": "https://files.pythonhosted.org/packages/d2/23/3b7b5cc5ab64cc096c4bcc61e15b7a91d14ba14f0d9f95267a1074a9eeda/lollipop_hypothesis-0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3be38f4bcc9c1220a2e7a2e77b70df04", "sha256": "0d8297a89e486037e0908b6dfe7ed1b4475a5642d2cbc48552a174d9a22d9ad1" }, "downloads": -1, "filename": "lollipop-hypothesis-0.2.tar.gz", "has_sig": false, "md5_digest": "3be38f4bcc9c1220a2e7a2e77b70df04", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7183, "upload_time": "2017-05-16T07:06:36", "url": "https://files.pythonhosted.org/packages/30/59/1c7e8f0db3ae2437db3bcca96e18beebaf3d8f1900ca9587ec72e70a42e6/lollipop-hypothesis-0.2.tar.gz" } ] }