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

Method test_write_to_fileobj

Lib/test/test_lzma.py:1178–1203  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1176 unlink(TESTFN)
1177
1178 def test_write_to_fileobj(self):
1179 try:
1180 with open(TESTFN, "wb") as raw:
1181 with LZMAFile(raw, "w") as f:
1182 f.write(INPUT)
1183 self.assertEqual(f.name, raw.name)
1184 self.assertEqual(f.fileno(), raw.fileno())
1185 self.assertEqual(f.mode, 'wb')
1186 self.assertIs(f.readable(), False)
1187 self.assertIs(f.writable(), True)
1188 self.assertIs(f.seekable(), False)
1189 self.assertIs(f.closed, False)
1190 self.assertIs(f.closed, True)
1191 with self.assertRaises(ValueError):
1192 f.name
1193 self.assertRaises(ValueError, f.fileno)
1194 self.assertEqual(f.mode, 'wb')
1195 self.assertRaises(ValueError, f.readable)
1196 self.assertRaises(ValueError, f.writable)
1197 self.assertRaises(ValueError, f.seekable)
1198
1199 expected = lzma.compress(INPUT)
1200 with open(TESTFN, "rb") as f:
1201 self.assertEqual(f.read(), expected)
1202 finally:
1203 unlink(TESTFN)
1204
1205 def test_write_to_fileobj_with_int_name(self):
1206 try:

Callers

nothing calls this directly

Calls 13

LZMAFileClass · 0.90
unlinkFunction · 0.90
openFunction · 0.50
writeMethod · 0.45
assertEqualMethod · 0.45
filenoMethod · 0.45
assertIsMethod · 0.45
readableMethod · 0.45
writableMethod · 0.45
seekableMethod · 0.45
assertRaisesMethod · 0.45
compressMethod · 0.45

Tested by

no test coverage detected