diff --git a/CHANGELOG.md b/CHANGELOG.md index 48a31c6..d7b02db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) ---------------------- diff --git a/README.md b/README.md index 60077ca..72b3b0f 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/email_validator/exceptions_types.py b/email_validator/exceptions_types.py index ee9d50a..4b8f200 100644 --- a/email_validator/exceptions_types.py +++ b/email_validator/exceptions_types.py @@ -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): diff --git a/email_validator/version.py b/email_validator/version.py index 7857319..80476c8 100644 --- a/email_validator/version.py +++ b/email_validator/version.py @@ -1 +1 @@ -__version__ = "2.0.0.post2" \ No newline at end of file +__version__ = "2.0.0.post2" diff --git a/tests/test_main.py b/tests/test_main.py index dc01bc1..49a3a77 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -64,4 +64,4 @@ def test_deprecation(): input_email = b"testaddr@example.tld" valid_email = validate_email(input_email, check_deliverability=False) with pytest.raises(DeprecationWarning): - assert valid_email.email is not None \ No newline at end of file + assert valid_email.email is not None diff --git a/tests/test_syntax.py b/tests/test_syntax.py index 57510e5..1c9659c 100644 --- a/tests/test_syntax.py +++ b/tests/test_syntax.py @@ -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(