Skip to content

Instantly share code, notes, and snippets.

@MartinThoma
Created August 1, 2020 06:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MartinThoma/16ba6ae417dcb628c4e0146e385a0bcd to your computer and use it in GitHub Desktop.
Save MartinThoma/16ba6ae417dcb628c4e0146e385a0bcd to your computer and use it in GitHub Desktop.
import hypothesis.strategies as s
from hypothesis import given
import mpu.string # Martins Python Utilities
@given(s.emails())
def test_is_email(email):
assert mpu.string.is_email(email), f"is_email({email}) returned False"
@given(s.ip_addresses(v=4))
def test_is_ipv4(ip):
assert mpu.string.is_ipv4(str(ip)), f"is_ipv4({ip}) returned False"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment