MCPcopy Index your code
hub / github.com/python/cpython / test_push_random

Method test_push_random

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

Source from the content-addressed store, hash-verified

3840 self.assertEqual(''.join([il for il, n in imt]), ''.join(om))
3841
3842 def test_push_random(self):
3843 from email.feedparser import BufferedSubFile, NeedMoreData
3844
3845 n = 10000
3846 chunksize = 5
3847 chars = 'abcd \t\r\n'
3848
3849 s = ''.join(choice(chars) for i in range(n)) + '\n'
3850 target = s.splitlines(True)
3851
3852 bsf = BufferedSubFile()
3853 lines = []
3854 for i in range(0, len(s), chunksize):
3855 chunk = s[i:i+chunksize]
3856 bsf.push(chunk)
3857 lines.extend(iter(bsf.readline, NeedMoreData))
3858 self.assertEqual(lines, target)
3859
3860
3861class TestFeedParsers(TestEmailBase):

Callers

nothing calls this directly

Calls 7

pushMethod · 0.95
BufferedSubFileClass · 0.90
choiceFunction · 0.85
joinMethod · 0.45
splitlinesMethod · 0.45
extendMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected