':py:obj:`Connection.set_context` raises :py:obj:`TypeError` if called with a
non-:py:obj:`Context` instance argument or with any number of arguments other
than 1.'

def test_set_context_wrong_args(self):

    ctx = Context(TLSv1_METHOD)
    connection = Connection(ctx, None)
    self.assertRaises(TypeError, connection.set_context)
    self.assertRaises(TypeError, connection.set_context, object())
    self.assertRaises(TypeError, connection.set_context, 'hello')
    self.assertRaises(TypeError, connection.set_context, 1)
    self.assertRaises(TypeError, connection.set_context, 1, 2)
    self.assertRaises(TypeError, connection.set_context, Context(TLSv1_METHOD), 2)
    self.assertIdentical(ctx, connection.get_context())
