本文整理汇总了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])