本文整理匯總了Python中email.errors.CloseBoundaryNotFoundDefect方法的典型用法代碼示例。如果您正苦於以下問題:Python errors.CloseBoundaryNotFoundDefect方法的具體用法?Python errors.CloseBoundaryNotFoundDefect怎麽用?Python errors.CloseBoundaryNotFoundDefect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類email.errors
的用法示例。
在下文中一共展示了errors.CloseBoundaryNotFoundDefect方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_missing_ending_boundary
# 需要導入模塊: from email import errors [as 別名]
# 或者: from email.errors import CloseBoundaryNotFoundDefect [as 別名]
def test_missing_ending_boundary(self):
source = textwrap.dedent("""\
To: 1@harrydomain4.com
Subject: Fwd: 1
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="------------000101020201080900040301"
--------------000101020201080900040301
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Alternative 1
--------------000101020201080900040301
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Alternative 2
""")
with self._raise_point(errors.CloseBoundaryNotFoundDefect):
msg = self._str_msg(source)
if self.raise_expected: return
self.assertEqual(len(msg.get_payload()), 2)
self.assertEqual(msg.get_payload(1).get_payload(), 'Alternative 2\n')
self.assertDefectsEqual(self.get_defects(msg),
[errors.CloseBoundaryNotFoundDefect])