-
-
Notifications
You must be signed in to change notification settings - Fork 435
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make sure sl_formataddr always return str (#1269)
- Loading branch information
1 parent
313a928
commit 192d03f
Showing
2 changed files
with
7 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -782,6 +782,10 @@ def test_add_header_multipart_with_invalid_part(): | |
|
||
|
||
def test_sl_formataddr(): | ||
# when the name part (first element in the tuple) is empty, formataddr() returns a Header | ||
# this makes sure sl_formataddr always returns str | ||
assert sl_formataddr(("", "[email protected]")) == "[email protected]" | ||
|
||
assert sl_formataddr(("é", "è@ç.à")) == "=?utf-8?b?w6k=?= <è@ç.à>" | ||
# test that the same name-address can't be handled by the built-in formataddr | ||
with pytest.raises(UnicodeEncodeError): | ||
|