本文整理汇总了Python中email.quopriMIME.unquote方法的典型用法代码示例。如果您正苦于以下问题:Python quopriMIME.unquote方法的具体用法?Python quopriMIME.unquote怎么用?Python quopriMIME.unquote使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类email.quopriMIME
的用法示例。
在下文中一共展示了quopriMIME.unquote方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_set_param
# 需要导入模块: from email import quopriMIME [as 别名]
# 或者: from email.quopriMIME import unquote [as 别名]
def test_set_param(self):
eq = self.assertEqual
msg = Message()
msg.set_param('charset', 'iso-2022-jp')
eq(msg.get_param('charset'), 'iso-2022-jp')
msg.set_param('importance', 'high value')
eq(msg.get_param('importance'), 'high value')
eq(msg.get_param('importance', unquote=False), '"high value"')
eq(msg.get_params(), [('text/plain', ''),
('charset', 'iso-2022-jp'),
('importance', 'high value')])
eq(msg.get_params(unquote=False), [('text/plain', ''),
('charset', '"iso-2022-jp"'),
('importance', '"high value"')])
msg.set_param('charset', 'iso-9999-xx', header='X-Jimmy')
eq(msg.get_param('charset', header='X-Jimmy'), 'iso-9999-xx')
示例2: test_get_param_with_semis_in_quotes
# 需要导入模块: from email import quopriMIME [as 别名]
# 或者: from email.quopriMIME import unquote [as 别名]
def test_get_param_with_semis_in_quotes(self):
msg = email.message_from_string(
'Content-Type: image/pjpeg; name="Jim&&Jill"\n')
self.assertEqual(msg.get_param('name'), 'Jim&&Jill')
self.assertEqual(msg.get_param('name', unquote=False),
'"Jim&&Jill"')
示例3: test_quote_unquote_idempotent
# 需要导入模块: from email import quopriMIME [as 别名]
# 或者: from email.quopriMIME import unquote [as 别名]
def test_quote_unquote_idempotent(self):
for x in range(256):
c = chr(x)
self.assertEqual(quopriMIME.unquote(quopriMIME.quote(c)), c)
示例4: test_get_param
# 需要导入模块: from email import quopriMIME [as 别名]
# 或者: from email.quopriMIME import unquote [as 别名]
def test_get_param(self):
eq = self.assertEqual
msg = self._msgobj('msg_29.txt')
eq(msg.get_param('title'),
('us-ascii', 'en', 'This is even more ***fun*** isn\'t it!'))
eq(msg.get_param('title', unquote=False),
('us-ascii', 'en', '"This is even more ***fun*** isn\'t it!"'))