當前位置: 首頁>>代碼示例>>Python>>正文


Python generator.DecodedGenerator方法代碼示例

本文整理匯總了Python中email.generator.DecodedGenerator方法的典型用法代碼示例。如果您正苦於以下問題:Python generator.DecodedGenerator方法的具體用法?Python generator.DecodedGenerator怎麽用?Python generator.DecodedGenerator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在email.generator的用法示例。


在下文中一共展示了generator.DecodedGenerator方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_decoded_generator

# 需要導入模塊: from email import generator [as 別名]
# 或者: from email.generator import DecodedGenerator [as 別名]
def test_decoded_generator(self):
        eq = self.assertEqual
        msg = self._msgobj('msg_07.txt')
        fp = openfile('msg_17.txt')
        try:
            text = fp.read()
        finally:
            fp.close()
        s = StringIO()
        g = DecodedGenerator(s)
        g.flatten(msg)
        eq(s.getvalue(), text) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:14,代碼來源:test_email_renamed.py

示例2: test_decoded_generator

# 需要導入模塊: from email import generator [as 別名]
# 或者: from email.generator import DecodedGenerator [as 別名]
def test_decoded_generator(self):
        eq = self.assertEqual
        msg = self._msgobj('msg_07.txt')
        with openfile('msg_17.txt') as fp:
            text = fp.read()
        s = StringIO()
        g = DecodedGenerator(s)
        g.flatten(msg)
        eq(s.getvalue(), text) 
開發者ID:IronLanguages,項目名稱:ironpython3,代碼行數:11,代碼來源:test_email.py

示例3: test_decoded_generator_emits_unicode_body

# 需要導入模塊: from email import generator [as 別名]
# 或者: from email.generator import DecodedGenerator [as 別名]
def test_decoded_generator_emits_unicode_body(self):
        m = email.message_from_bytes(self.latin_bin_msg)
        out = StringIO()
        email.generator.DecodedGenerator(out).flatten(m)
        #DecodedHeader output contains an extra blank line compared
        #to the input message.  RDM: not sure if this is a bug or not,
        #but it is not specific to the 8bit->7bit conversion.
        self.assertEqual(out.getvalue(),
            self.latin_bin_msg.decode('latin-1')+'\n') 
開發者ID:IronLanguages,項目名稱:ironpython3,代碼行數:11,代碼來源:test_email.py


注:本文中的email.generator.DecodedGenerator方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。