我们从Python开源项目中,提取了以下34个代码示例,用于说明如何使用email.errors.StartBoundaryNotFoundDefect()。
def test_missing_start_boundary(self): outer = self._msgobj('msg_42.txt') # The message structure is: # # multipart/mixed # text/plain # message/rfc822 # multipart/mixed [*] # # [*] This message is missing its start boundary bad = outer.get_payload(1).get_payload(0) self.assertEqual(len(bad.defects), 1) self.failUnless(isinstance(bad.defects[0], errors.StartBoundaryNotFoundDefect)) # Test RFC 2047 header encoding and decoding
def test_missing_start_boundary(self): outer = self._msgobj('msg_42.txt') # The message structure is: # # multipart/mixed # text/plain # message/rfc822 # multipart/mixed [*] # # [*] This message is missing its start boundary bad = outer.get_payload(1).get_payload(0) self.assertEqual(len(bad.defects), 1) self.assertTrue(isinstance(bad.defects[0], errors.StartBoundaryNotFoundDefect)) # test_defect_handling
def test_missing_start_boundary(self): outer = self._msgobj('msg_42.txt') # The message structure is: # # multipart/mixed # text/plain # message/rfc822 # multipart/mixed [*] # # [*] This message is missing its start boundary bad = outer.get_payload(1).get_payload(0) self.assertEqual(len(bad.defects), 1) self.assertIsInstance(bad.defects[0], errors.StartBoundaryNotFoundDefect) # test_defect_handling
def test_same_boundary_inner_outer(self): unless = self.failUnless msg = self._msgobj('msg_15.txt') # XXX We can probably eventually do better inner = msg.get_payload(0) unless(hasattr(inner, 'defects')) self.assertEqual(len(inner.defects), 1) unless(isinstance(inner.defects[0], errors.StartBoundaryNotFoundDefect))
def test_same_boundary_inner_outer(self): msg = self._msgobj('msg_15.txt') # XXX We can probably eventually do better inner = msg.get_payload(0) self.assertTrue(hasattr(inner, 'defects')) self.assertEqual(len(inner.defects), 1) self.assertIsInstance(inner.defects[0], errors.StartBoundaryNotFoundDefect)
def test_missing_start_boundary(self): outer = self._msgobj('msg_42.txt') # The message structure is: # # multipart/mixed # text/plain # message/rfc822 # multipart/mixed [*] # # [*] This message is missing its start boundary bad = outer.get_payload(1).get_payload(0) self.assertEqual(len(bad.defects), 1) self.assertIsInstance(bad.defects[0], errors.StartBoundaryNotFoundDefect)
def test_same_boundary_inner_outer(self): unless = self.assertTrue msg = self._msgobj('msg_15.txt') # XXX We can probably eventually do better inner = msg.get_payload(0) unless(hasattr(inner, 'defects')) self.assertEqual(len(inner.defects), 1) unless(isinstance(inner.defects[0], errors.StartBoundaryNotFoundDefect))
def test_missing_start_boundary(self): outer = self._msgobj('msg_42.txt') # The message structure is: # # multipart/mixed # text/plain # message/rfc822 # multipart/mixed [*] # # [*] This message is missing its start boundary bad = outer.get_payload(1).get_payload(0) self.assertEqual(len(bad.defects), 1) self.assertTrue(isinstance(bad.defects[0], errors.StartBoundaryNotFoundDefect))
def test_same_boundary_inner_outer(self): unless = self.assertTrue msg = self._msgobj('msg_15.txt') # XXX We can probably eventually do better inner = msg.get_payload(0) unless(hasattr(inner, 'defects')) self.assertEqual(len(inner.defects), 1) unless(isinstance(inner.defects[0], errors.StartBoundaryNotFoundDefect)) # test_defect_handling
def test_same_boundary_inner_outer(self): msg = self._msgobj('msg_15.txt') # XXX We can probably eventually do better inner = msg.get_payload(0) self.assertTrue(hasattr(inner, 'defects')) self.assertEqual(len(inner.defects), 1) self.assertIsInstance(inner.defects[0], errors.StartBoundaryNotFoundDefect) # test_defect_handling
def test_bytes_parser_on_exception_does_not_close_file(self): with openfile('msg_15.txt', 'rb') as fp: bytesParser = email.parser.BytesParser self.assertRaises(email.errors.StartBoundaryNotFoundDefect, bytesParser(policy=email.policy.strict).parse, fp) self.assertFalse(fp.closed)
def test_parser_on_exception_does_not_close_file(self): with openfile('msg_15.txt', 'r') as fp: parser = email.parser.Parser self.assertRaises(email.errors.StartBoundaryNotFoundDefect, parser(policy=email.policy.strict).parse, fp) self.assertFalse(fp.closed)