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

Method test_binary_modes

Lib/test/test_zstd.py:2511–2522  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2509class OpenTestCase(unittest.TestCase):
2510
2511 def test_binary_modes(self):
2512 with open(io.BytesIO(COMPRESSED_100_PLUS_32KB), "rb") as f:
2513 self.assertEqual(f.read(), DECOMPRESSED_100_PLUS_32KB)
2514 with io.BytesIO() as bio:
2515 with open(bio, "wb") as f:
2516 f.write(DECOMPRESSED_100_PLUS_32KB)
2517 file_data = decompress(bio.getvalue())
2518 self.assertEqual(file_data, DECOMPRESSED_100_PLUS_32KB)
2519 with open(bio, "ab") as f:
2520 f.write(DECOMPRESSED_100_PLUS_32KB)
2521 file_data = decompress(bio.getvalue())
2522 self.assertEqual(file_data, DECOMPRESSED_100_PLUS_32KB * 2)
2523
2524 def test_text_modes(self):
2525 # empty input

Callers

nothing calls this directly

Calls 6

openFunction · 0.90
decompressFunction · 0.90
assertEqualMethod · 0.45
readMethod · 0.45
writeMethod · 0.45
getvalueMethod · 0.45

Tested by

no test coverage detected