Skip to content

Commit 5abaa7b

Browse files
committed
Fix tests and add CHANGLOG entry for last commit
1 parent 68b9d18 commit 5abaa7b

File tree

6 files changed

+15
-6
lines changed

6 files changed

+15
-6
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
In Development
2+
--------------
3+
4+
* 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.
5+
* A `__version__` module attribute is added.
6+
17
2.0.0 (April 15, 2023)
28
----------------------
39

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ The package is distributed as a universal wheel and as a source package.
436436
To release:
437437

438438
* Update CHANGELOG.md.
439-
* Update the version number in setup.cfg.
439+
* Update the version number in `email_validator/version.py`.
440440
* Make & push a commit with the new version number and make sure tests pass.
441441
* Make & push a tag (see command below).
442442
* Make a release at https://github.com/JoshData/python-email-validator/releases/new.

email_validator/exceptions_types.py

-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ def email(self):
8484
warnings.warn("ValidatedEmail.email is deprecated and will be removed, use ValidatedEmail.normalized instead", DeprecationWarning)
8585
return self.normalized
8686

87-
8887
"""For backwards compatibility, some fields are also exposed through a dict-like interface. Note
8988
that some of the names changed when they became attributes."""
9089
def __getitem__(self, key):

email_validator/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "2.0.0.post2"
1+
__version__ = "2.0.0.post2"

tests/test_main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,4 @@ def test_deprecation():
6464
input_email = b"testaddr@example.tld"
6565
valid_email = validate_email(input_email, check_deliverability=False)
6666
with pytest.raises(DeprecationWarning):
67-
assert valid_email.email is not None
67+
assert valid_email.email is not None

tests/test_syntax.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,12 @@ def test_email_valid(email_input, output):
7878
assert emailinfo == output
7979
assert validate_email(email_input, check_deliverability=False, allow_smtputf8=True) == output
8080

81-
# Check that the old way to access the normalized form still works.
82-
assert emailinfo.email == emailinfo.normalized
81+
# Check that the old `email` attribute to access the normalized form still works
82+
# if the DeprecationWarning is suppressed.
83+
import warnings
84+
with warnings.catch_warnings():
85+
warnings.filterwarnings("ignore", category=DeprecationWarning)
86+
assert emailinfo.email == emailinfo.normalized
8387

8488

8589
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)