MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_pushCR_LF

Method test_pushCR_LF

Lib/test/test_email/test_email.py:3879–3907  ·  view source on GitHub ↗

FeedParser BufferedSubFile.push() assumed it received complete line endings. A CR ending one push() followed by a LF starting the next push() added an empty line.

(self)

Source from the content-addressed store, hash-verified

3877
3878 @unittest.expectedFailure # TODO: RUSTPYTHON
3879 def test_pushCR_LF(self):
3880 '''FeedParser BufferedSubFile.push() assumed it received complete
3881 line endings. A CR ending one push() followed by a LF starting
3882 the next push() added an empty line.
3883 '''
3884 imt = [
3885 ("a\r \n", 2),
3886 ("b", 0),
3887 ("c\n", 1),
3888 ("", 0),
3889 ("d\r\n", 1),
3890 ("e\r", 0),
3891 ("\nf", 1),
3892 ("\r\n", 1),
3893 ]
3894 from email.feedparser import BufferedSubFile, NeedMoreData
3895 bsf = BufferedSubFile()
3896 om = []
3897 nt = 0
3898 for il, n in imt:
3899 bsf.push(il)
3900 nt += n
3901 n1 = 0
3902 for ol in iter(bsf.readline, NeedMoreData):
3903 om.append(ol)
3904 n1 += 1
3905 self.assertEqual(n, n1)
3906 self.assertEqual(len(om), nt)
3907 self.assertEqual(''.join([il for il, n in imt]), ''.join(om))
3908
3909 @unittest.expectedFailure # TODO: RUSTPYTHON
3910 def test_push_random(self):

Callers

nothing calls this directly

Calls 7

pushMethod · 0.95
BufferedSubFileClass · 0.90
iterFunction · 0.85
lenFunction · 0.85
appendMethod · 0.45
assertEqualMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected