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

Method test_open_wb

Lib/test/test_pathlib/test_write.py:50–58  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

48 self.assertEqual(wc.filename, __file__)
49
50 def test_open_wb(self):
51 p = self.root / 'fileA'
52 with magic_open(p, 'wb') as f:
53 #self.assertIsInstance(f, io.BufferedWriter)
54 f.write(b'this is file A\n')
55 self.assertEqual(self.ground.readbytes(p), b'this is file A\n')
56 self.assertRaises(ValueError, magic_open, p, 'wb', encoding='utf8')
57 self.assertRaises(ValueError, magic_open, p, 'wb', errors='strict')
58 self.assertRaises(ValueError, magic_open, p, 'wb', newline='')
59
60 def test_write_bytes(self):
61 p = self.root / 'fileA'

Callers

nothing calls this directly

Calls 5

magic_openFunction · 0.90
writeMethod · 0.45
assertEqualMethod · 0.45
readbytesMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected