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

Method test_binary_modes

Lib/test/test_bz2.py:1086–1101  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1084 return bz2.open(*args, **kwargs)
1085
1086 def test_binary_modes(self):
1087 for mode in ("wb", "xb"):
1088 if mode == "xb":
1089 unlink(self.filename)
1090 with self.open(self.filename, mode) as f:
1091 f.write(self.TEXT)
1092 with open(self.filename, "rb") as f:
1093 file_data = ext_decompress(f.read())
1094 self.assertEqual(file_data, self.TEXT)
1095 with self.open(self.filename, "rb") as f:
1096 self.assertEqual(f.read(), self.TEXT)
1097 with self.open(self.filename, "ab") as f:
1098 f.write(self.TEXT)
1099 with open(self.filename, "rb") as f:
1100 file_data = ext_decompress(f.read())
1101 self.assertEqual(file_data, self.TEXT * 2)
1102
1103 def test_implicit_binary_modes(self):
1104 # Test implicit binary modes (no "b" or "t" in mode string).

Callers

nothing calls this directly

Calls 7

openMethod · 0.95
unlinkFunction · 0.90
ext_decompressFunction · 0.85
openFunction · 0.50
writeMethod · 0.45
readMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected