forked from pool/python
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:Factory/python?expand=0&rev=406
33 lines
1.2 KiB
Diff
33 lines
1.2 KiB
Diff
---
|
|
Lib/email/test/test_email.py | 7 +++++++
|
|
Lib/email/utils.py | 2 +-
|
|
2 files changed, 8 insertions(+), 1 deletion(-)
|
|
|
|
--- a/Lib/email/test/test_email.py
|
|
+++ b/Lib/email/test/test_email.py
|
|
@@ -2502,6 +2502,13 @@ Foo
|
|
# Test Utils.supports_strict_parsing attribute
|
|
self.assertEqual(Utils.supports_strict_parsing, True)
|
|
|
|
+ def test_parsing_unicode_str(self):
|
|
+ email_in = "Honza Novák <honza@example.com>"
|
|
+ self.assertEqual(Utils.parseaddr("Honza str Novák <honza@example.com>"),
|
|
+ ('Honza str Nov\xc3\xa1k', 'honza@example.com'))
|
|
+ self.assertEqual(Utils.parseaddr(u"Honza unicode Novák <honza@example.com>"),
|
|
+ (u'Honza unicode Nov\xe1k', u'honza@example.com'))
|
|
+
|
|
def test_getaddresses_nasty(self):
|
|
for addresses, expected in (
|
|
([u'"Sürname, Firstname" <to@example.com>'],
|
|
--- a/Lib/email/utils.py
|
|
+++ b/Lib/email/utils.py
|
|
@@ -307,7 +307,7 @@ def parseaddr(addr, strict=True):
|
|
if isinstance(addr, list):
|
|
addr = addr[0]
|
|
|
|
- if not isinstance(addr, str):
|
|
+ if not isinstance(addr, basestring):
|
|
return ('', '')
|
|
|
|
addr = _pre_parse_validation([addr])[0]
|