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

Method test_sendbytes

Lib/test/_test_multiprocessing.py:3800–3830  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3798 p.join()
3799
3800 def test_sendbytes(self):
3801 if self.TYPE != 'processes':
3802 self.skipTest('test not appropriate for {}'.format(self.TYPE))
3803
3804 msg = latin('abcdefghijklmnopqrstuvwxyz')
3805 a, b = self.Pipe()
3806
3807 a.send_bytes(msg)
3808 self.assertEqual(b.recv_bytes(), msg)
3809
3810 a.send_bytes(msg, 5)
3811 self.assertEqual(b.recv_bytes(), msg[5:])
3812
3813 a.send_bytes(msg, 7, 8)
3814 self.assertEqual(b.recv_bytes(), msg[7:7+8])
3815
3816 a.send_bytes(msg, 26)
3817 self.assertEqual(b.recv_bytes(), latin(''))
3818
3819 a.send_bytes(msg, 26, 0)
3820 self.assertEqual(b.recv_bytes(), latin(''))
3821
3822 self.assertRaises(ValueError, a.send_bytes, msg, 27)
3823
3824 self.assertRaises(ValueError, a.send_bytes, msg, 22, 5)
3825
3826 self.assertRaises(ValueError, a.send_bytes, msg, 26, 1)
3827
3828 self.assertRaises(ValueError, a.send_bytes, msg, -1)
3829
3830 self.assertRaises(ValueError, a.send_bytes, msg, 4, -1)
3831
3832 @classmethod
3833 def _is_fd_assigned(cls, fd):

Callers

nothing calls this directly

Calls 8

latinFunction · 0.85
skipTestMethod · 0.80
PipeMethod · 0.80
formatMethod · 0.45
send_bytesMethod · 0.45
assertEqualMethod · 0.45
recv_bytesMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected