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

Method setUpClass

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

Source from the content-addressed store, hash-verified

6716
6717 @classmethod
6718 def setUpClass(cls):
6719 def chunks(total, step):
6720 assert total >= step
6721 while total > step:
6722 yield step
6723 total -= step
6724 if total:
6725 yield total
6726
6727 chunk = b"".join([random.choice(string.ascii_letters).encode()
6728 for i in range(cls.BUFSIZE)])
6729 with open(os_helper.TESTFN, 'wb') as f:
6730 for csize in chunks(cls.FILESIZE, cls.BUFSIZE):
6731 f.write(chunk)
6732 with open(os_helper.TESTFN, 'rb') as f:
6733 cls.FILEDATA = f.read()
6734 assert len(cls.FILEDATA) == cls.FILESIZE
6735
6736 @classmethod
6737 def tearDownClass(cls):

Callers

nothing calls this directly

Calls 8

chunksFunction · 0.85
lenFunction · 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