Hypothesis extension to allow generating strings based on regex
Project description
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
Python >= 2.7 and <= 3.6
hypothesis >= 3.8
Project Links
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)
Built Distribution
Close
Hashes for hypothesis_regex-0.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a03cec68bbe8a6d7dedd8ba6ca59a93afe43613431b2223593a9e45136d5120b |
|
MD5 | a4077c8b6635088cc9a849d8dd6d7dd4 |
|
BLAKE2b-256 | c93c69534bb7ece9ceadb2daeb5bf3bfbb242a25f56daaed5c33aa6b48759548 |