You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: base_test.go
    path of file: ./repos/pg
    
    the code of the file until where you have to start completion: package pg

import (
	"context"
	"encoding/binary"
	"net"
	"testing"
	"time"

	"github.com/go-pg/pg/v10/internal/pool"
	"github.com/stretchr/testify/assert"
)

/*
	The test is for testing the case that sending a cancel request when the timeout from connection comes earlier than ctx.Done().
*/
func Test_baseDB_withConn(t *testing.T) {
	b := mockBaseDB{}
	b.init()
	b.pool = &mockPooler{}
	ctx, _ := context.WithDeadline(context.TODO(), time.Now().Add(1000*time.Second)) // Make a deadline in context further 
    
func Test_baseDB_withConn(t *testing.T) {
	b := mockBaseDB{}
	b.init()
	b.pool = &mockPooler{}
	ctx, _ := context.WithDeadline(context.TODO(), time.Now().Add(1000*time.Second)) // Make a deadline in context further than the timeout of connection.
	b.withConn(ctx, func(context.Context, *pool.Conn) error {
		// Immediately returns the error, so it is faster than the ctx.Done() returns. The error code here according to the function `isBadConn`.
		return &mockPGError{map[byte]string{byte('C'): "57014"}}
	})
	// In the new change, a cancel request is sent to db and that connection is removed from the connection pool.
	// Check if the cancel request, its code int32(80877102), is sent.
	assert.Equal(t, int32(80877102), b.pool.(*mockPooler).mockConn.cancelCode)
	assert.True(t, b.pool.(*mockPooler).toRemove)
}