librefi/tests/string_generators.py

23 lines
579 B
Python

# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from librefi.utils import get_user_agent, get_email_address
from librefi.compat import compat_str
import re
def test_email_address():
email = get_email_address()
assert isinstance(email, compat_str)
assert re.search(
# intentionally dumb and not covering a lot of actual emails
r"^[a-zA-Z\d](?:[a-zA-Z\d._-]*[a-zA-Z\d])?@[a-z-\d]+(?:\.[a-z-\d]+)+$",
email) is not None
pass
def test_user_agent():
ua = get_user_agent()
assert isinstance(ua, compat_str)
pass