MCPcopy Create free account
hub / github.com/python/cpython / test_newlines

Method test_newlines

Lib/test/test_email/test_email.py:3875–3891  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3873 self.assertEqual(msg['Second'], 'val')
3874
3875 def test_newlines(self):
3876 m = self.parse(['a:\nb:\rc:\r\nd:\n'])
3877 self.assertEqual(m.keys(), ['a', 'b', 'c', 'd'])
3878 m = self.parse(['a:\nb:\rc:\r\nd:'])
3879 self.assertEqual(m.keys(), ['a', 'b', 'c', 'd'])
3880 m = self.parse(['a:\rb', 'c:\n'])
3881 self.assertEqual(m.keys(), ['a', 'bc'])
3882 m = self.parse(['a:\r', 'b:\n'])
3883 self.assertEqual(m.keys(), ['a', 'b'])
3884 m = self.parse(['a:\r', '\nb:\n'])
3885 self.assertEqual(m.keys(), ['a', 'b'])
3886
3887 # Only CR and LF should break header fields
3888 m = self.parse(['a:\x85b:\u2028c:\n'])
3889 self.assertEqual(m.items(), [('a', '\x85b:\u2028c:')])
3890 m = self.parse(['a:\r', 'b:\x85', 'c:\n'])
3891 self.assertEqual(m.items(), [('a', ''), ('b', '\x85c:')])
3892
3893 def test_long_lines(self):
3894 # Expected peak memory use on 32-bit platform: 6*N*M bytes.

Callers

nothing calls this directly

Calls 4

parseMethod · 0.95
assertEqualMethod · 0.45
keysMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected