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

Method test_implicit_binary_modes

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

Source from the content-addressed store, hash-verified

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).
1105 for mode in ("w", "x"):
1106 if mode == "x":
1107 unlink(self.filename)
1108 with self.open(self.filename, mode) as f:
1109 f.write(self.TEXT)
1110 with open(self.filename, "rb") as f:
1111 file_data = ext_decompress(f.read())
1112 self.assertEqual(file_data, self.TEXT)
1113 with self.open(self.filename, "r") as f:
1114 self.assertEqual(f.read(), self.TEXT)
1115 with self.open(self.filename, "a") as f:
1116 f.write(self.TEXT)
1117 with open(self.filename, "rb") as f:
1118 file_data = ext_decompress(f.read())
1119 self.assertEqual(file_data, self.TEXT * 2)
1120
1121 def test_text_modes(self):
1122 text = self.TEXT.decode("ascii")

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