Skip to content

Commit

Permalink
Fix tests and add CHANGLOG entry for last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshData committed Jun 5, 2023
1 parent 68b9d18 commit 5abaa7b
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
In Development
--------------

* The old `email` field on the returned `ValidatedEmail` object, which in the previous version was superseded by `normalized`, will now raise a deprecation warning if used. See https://stackoverflow.com/q/879173 for strategies to suppress the DeprecationWarning.
* A `__version__` module attribute is added.

2.0.0 (April 15, 2023)
----------------------

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ The package is distributed as a universal wheel and as a source package.
To release:

* Update CHANGELOG.md.
* Update the version number in setup.cfg.
* Update the version number in `email_validator/version.py`.
* Make & push a commit with the new version number and make sure tests pass.
* Make & push a tag (see command below).
* Make a release at https://github.com/JoshData/python-email-validator/releases/new.
Expand Down
1 change: 0 additions & 1 deletion email_validator/exceptions_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ def email(self):
warnings.warn("ValidatedEmail.email is deprecated and will be removed, use ValidatedEmail.normalized instead", DeprecationWarning)
return self.normalized


"""For backwards compatibility, some fields are also exposed through a dict-like interface. Note
that some of the names changed when they became attributes."""
def __getitem__(self, key):
Expand Down
2 changes: 1 addition & 1 deletion email_validator/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.0.0.post2"
__version__ = "2.0.0.post2"
2 changes: 1 addition & 1 deletion tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ def test_deprecation():
input_email = b"[email protected]"
valid_email = validate_email(input_email, check_deliverability=False)
with pytest.raises(DeprecationWarning):
assert valid_email.email is not None
assert valid_email.email is not None
8 changes: 6 additions & 2 deletions tests/test_syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,12 @@ def test_email_valid(email_input, output):
assert emailinfo == output
assert validate_email(email_input, check_deliverability=False, allow_smtputf8=True) == output

# Check that the old way to access the normalized form still works.
assert emailinfo.email == emailinfo.normalized
# Check that the old `email` attribute to access the normalized form still works
# if the DeprecationWarning is suppressed.
import warnings
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
assert emailinfo.email == emailinfo.normalized


@pytest.mark.parametrize(
Expand Down

0 comments on commit 5abaa7b

Please sign in to comment.