Skip to main content

Hypothesis extension to allow generating strings based on regex

Project description

License: MIT Build Status PyPI

Hypothesis extension to allow generating strings based on regex. Useful in case you have some schema (e.g. JSON Schema) which already has regular expressions validating data.

Example

from hypothesis_regex import regex
import requests
import json

EMAIL_REGEX = r"^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]{2,}\.[a-zA-Z0-9-.]{2,}$"

@given(regex(EMAIL_REGEX))
def test_registering_user(email):
    response = requests.post('/signup', json.dumps({'email': email}))
    assert response.status_code == 201

Installation

$ pip install hypothesis-regex

Requirements

License

MIT licensed. See the bundled LICENSE file for more details.

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

hypothesis-regex-0.2.tar.gz (9.6 kB view hashes)

Uploaded Source

Built Distribution

hypothesis_regex-0.2-py2.py3-none-any.whl (7.1 kB view hashes)

Uploaded Python 2 Python 3

Supported by

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