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

Method test_write_bad_args

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

Source from the content-addressed store, hash-verified

1241 unlink(TESTFN)
1242
1243 def test_write_bad_args(self):
1244 f = LZMAFile(BytesIO(), "w")
1245 f.close()
1246 self.assertRaises(ValueError, f.write, b"foo")
1247 with LZMAFile(BytesIO(COMPRESSED_XZ), "r") as f:
1248 self.assertRaises(ValueError, f.write, b"bar")
1249 with LZMAFile(BytesIO(), "w") as f:
1250 self.assertRaises(TypeError, f.write, None)
1251 self.assertRaises(TypeError, f.write, "text")
1252 self.assertRaises(TypeError, f.write, 789)
1253
1254 def test_writelines(self):
1255 with BytesIO(INPUT) as f:

Callers

nothing calls this directly

Calls 4

closeMethod · 0.95
LZMAFileClass · 0.90
BytesIOClass · 0.90
assertRaisesMethod · 0.45

Tested by

no test coverage detected