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

Method setUpClass

Lib/test/test_socket.py:6821–6837  ·  view source on GitHub ↗
(cls)

Source from the content-addressed store, hash-verified

6819
6820 @classmethod
6821 def setUpClass(cls):
6822 def chunks(total, step):
6823 assert total >= step
6824 while total > step:
6825 yield step
6826 total -= step
6827 if total:
6828 yield total
6829
6830 chunk = b"".join([random.choice(string.ascii_letters).encode()
6831 for i in range(cls.BUFSIZE)])
6832 with open(os_helper.TESTFN, 'wb') as f:
6833 for csize in chunks(cls.FILESIZE, cls.BUFSIZE):
6834 f.write(chunk)
6835 with open(os_helper.TESTFN, 'rb') as f:
6836 cls.FILEDATA = f.read()
6837 assert len(cls.FILEDATA) == cls.FILESIZE
6838
6839 @classmethod
6840 def tearDownClass(cls):

Callers

nothing calls this directly

Calls 7

chunksFunction · 0.85
choiceMethod · 0.80
openFunction · 0.50
joinMethod · 0.45
encodeMethod · 0.45
writeMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected