func TestBucket_Put_Repeat(t *testing.T) {
	withOpenDB(func(db *DB, path string) {
		db.Update(func(tx *Tx) error {
			tx.CreateBucket([]byte("widgets"))
			b := tx.Bucket([]byte("widgets"))
			assert.NoError(t, b.Put([]byte("foo"), []byte("bar")))
			assert.NoError(t, b.Put([]byte("foo"), []byte("baz")))
			value := tx.Bucket([]byte("widgets")).Get([]byte("foo"))
			assert.Equal(t, value, []byte("baz"))
			return nil
		})
	})
}
Ensure that a bucket can rewrite a key in the same transaction.
package bolt
import (
	"bytes"
	"errors"
	"fmt"
	"os"
	"strconv"
	"strings"
	"testing"
	"testing/quick"
	"github.com/stretchr/testify/assert"
)
func TestBucket_Get_NonExistent(t *testing.T) {
	withOpenDB(func(db *DB, path string) {
		db.Update(func(tx *Tx) error {
			tx.CreateBucket([]byte("widgets"))
			value := tx.Bucket([]byte("widgets")).Get([]byte("foo"))
			assert.Nil(t, value)
			return nil
		})
	})
}
func TestBucket_Get_FromNode(t *testing.T) {
	withOpenDB(func(db *DB, path string) {
		db.Update(func(tx *Tx) error {
			tx.CreateBucket([]byte("widgets"))
			b := tx.Bucket([]byte("widgets"))
			b.Put([]byte("foo"), []byte("bar"))
			value := b.Get([]byte("foo"))
			assert.Equal(t, value, []byte("bar"))
			return nil
		})
	})
}
func TestBucket_Get_IncompatibleValue(t *testing.T) {
	withOpenDB(func(db *DB, path string) {
		db.Update(func(tx *Tx) error {
			tx.CreateBucket([]byte("widgets"))
			_, err := tx.Bucket([]byte("widgets")).CreateBucket([]byte("foo"))
			assert.NoError(t, err)
			assert.Nil(t, tx.Bucket([]byte("widgets")).Get([]byte("foo")))
			return nil
		})
	})
}
func TestBucket_Put(t *testing.T) {
	withOpenDB(func(db *DB, path string) {
		db.Update(func(tx *Tx) error {
			tx.CreateBucket([]byte("widgets"))
			err := tx.Bucket([]byte("widgets")).Put([]byte("foo"), []byte("bar"))
			assert.NoError(t, err)
			value := tx.Bucket([]byte("widgets")).Get([]byte("foo"))
			assert.Equal(t, value, []byte("bar"))
			return nil
		})
	})
}