'When passed a text, :py:obj:`Connection.send` transmits all of it and
returns the number of bytes sent. It also raises a DeprecationWarning.'

def test_text(self):

    (server, client) = self._loopback()
    with catch_warnings(record=True) as w:
        simplefilter('always')
        count = server.send('xy'.decode('ascii'))
        self.assertEqual('{0}    for    buf    is    no    longer    accepted,    use    bytes'.format(WARNING_TYPE_EXPECTED), str(w[(-1)].message))
        self.assertIs(w[(-1)].category, DeprecationWarning)
    self.assertEquals(count, 2)
    self.assertEquals(client.recv(2), 'xy')
