(email_input: str, output: ValidatedEmail)
| 143 | ], |
| 144 | ) |
| 145 | def test_email_valid(email_input: str, output: ValidatedEmail) -> None: |
| 146 | # These addresses do not require SMTPUTF8. See test_email_valid_intl_local_part |
| 147 | # for addresses that are valid but require SMTPUTF8. Check that it passes with |
| 148 | # allow_smtput8 both on and off. |
| 149 | emailinfo = validate_email(email_input, check_deliverability=False, allow_smtputf8=False, |
| 150 | allow_quoted_local=True, allow_display_name=True) |
| 151 | |
| 152 | assert emailinfo == output |
| 153 | assert validate_email(email_input, check_deliverability=False, allow_smtputf8=True, |
| 154 | allow_quoted_local=True, allow_display_name=True) == output |
| 155 | |
| 156 | # Check that the old `email` attribute to access the normalized form still works |
| 157 | # if the DeprecationWarning is suppressed. |
| 158 | import warnings |
| 159 | with warnings.catch_warnings(): |
| 160 | warnings.filterwarnings("ignore", category=DeprecationWarning) |
| 161 | assert emailinfo.email == emailinfo.normalized |
| 162 | |
| 163 | |
| 164 | @pytest.mark.parametrize( |
nothing calls this directly
no test coverage detected