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

Method test_binary_modes

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

Source from the content-addressed store, hash-verified

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