Skip to content

Commit

Permalink
Add test + release notes
Browse files Browse the repository at this point in the history
  • Loading branch information
Zac-HD committed Mar 16, 2023
1 parent f91eed5 commit c2d863a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ their individual contributions.
* `James Lamb <https://github.com/jameslamb>`_
* `Jenny Rouleau <https://github.com/jennyrou>`_
* `Jens Heinrich <https://github.com/JensHeinrich>`_
* `Jens Tröger <https://github.com/jenstroeger>`_
* `Jeremy Thurgood <https://github.com/jerith>`_
* `J.J. Green <http://soliton.vm.bytemark.co.uk/pub/jjg/>`_
* `JP Viljoen <https://github.com/froztbyte>`_ (froztbyte@froztbyte.net)
Expand Down
8 changes: 8 additions & 0 deletions hypothesis-python/RELEASE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
RELEASE_TYPE: minor

This release adds an optional ``domains=`` parameter to the
:func:`~hypothesis.strategies.emails` strategy, and excludes
the special-use :wikipedia:`.arpa` domain from the default
strategy (:issue:`3567`).

Thanks to Jens Tröger for reporting and fixing this bug!
10 changes: 8 additions & 2 deletions hypothesis-python/tests/nocover/test_emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,19 @@
# obtain one at https://mozilla.org/MPL/2.0/.

from hypothesis import given
from hypothesis.strategies import emails
from hypothesis.strategies import emails, just


@given(emails())
def test_is_valid_email(address):
def test_is_valid_email(address: str):
local, at_, domain = address.rpartition("@")
assert len(address) <= 254
assert at_ == "@"
assert local
assert domain
assert not domain.lower().endswith(".arpa")


@given(emails(domains=just("mydomain.com")))
def test_can_restrict_email_domains(address: str):
assert address.endswith("@mydomain.com")

0 comments on commit c2d863a

Please sign in to comment.