Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(13)  |  Call(13)  |  Derive(0)  |  Import(0)
Buffered network connection.

src/t/u/turnstile-HEAD/tests/unit/test_remote.py   turnstile(Download)
    def test_init(self):
        conn = remote.Connection('socket')
 
        self.assertEqual(conn._sock, 'socket')
        self.assertEqual(conn._recvbuf, [])
        self.assertEqual(conn._recvbuf_partial, '')
 
    def test_close(self):
        sock = mock.Mock()
        conn = remote.Connection(sock)
    def test_send_closed(self, mock_close):
        conn = remote.Connection(None)
 
        self.assertRaises(remote.ConnectionClosed, conn.send, 'cmd', 'arg1',
                          'arg2')
 
        sock = mock.Mock()
        conn = remote.Connection(sock)
 
        conn.send('cmd', 'arg1', 'arg2')
 
        sock = mock.Mock(**{'sendall.side_effect': socket.error()})
        conn = remote.Connection(sock)
 
        self.assertRaises(socket.error, conn.send, 'cmd', 'arg1', 'arg2')