<commit_before>// +build e2e

package token

import (
	"testing"

	"github.com/twinj/uuid"

	redis "gopkg.in/redis.v5"
)

func TestRedisStore(t *testing.T) {
	k, v := uuid.NewV4().String(), []byte(uuid.NewV4().String())
	s := &redisStore{client: redis.NewClient(&redis.Options{
		Addr:     "localhost:6379",
		Password: "",
		DB:       0,
	})}
	err := s.Set(k, v)
	if err != nil {
		t.Errorf("Expected error to be nil, got %v", err)
	}
	got, err := s.Get(k)
	if err != nil {
		t.Errorf("Expected error to be nil, got %v", err)
	}
	if string(got) != string(v) {
		t.Errorf("Got %v, expected %v", got, v)
	}
}<commit_msg>Expand tests for redis<commit_after>// +build e2e

package token

import (
	"testing"

	"github.com/twinj/uuid"

	redis "gopkg.in/redis.v5"
)

func TestSetAndGet(t *testing.T) {
	k, v := uuid.NewV4().String(), []byte(uuid.NewV4().String())
	s := &redisStore{client: redis.NewClient(&redis.Options{
		Addr:     "localhost:6379",
		Password: "",
		DB:       0,
	})}
	err := s.Set(k, v)
	if err != nil {
		t.Errorf("Expected error to be nil, got %v", err)
	}
	got, err := s.Get(k)
	if err != nil {
		t.Errorf("Expected error to be nil, got %v", err)
	}
	if string(got) != string(v) {
		t.Errorf("Got %v, expected %v", got, v)
	}
}

func TestGetOfNonExistentKey(t *testing.T) {
	s := &redisStore{client: redis.NewClient(&redis.Options{
		Addr:     "localhost:6379",
		Password: "",
		DB:       0,
	})}
	_, err := s.Get("notexistent")
	if err == nil {
		t.Errorf("Expected an error, got %v", err)
	}
}
{'fraction_non_alphanumeric': 0.1966996699669967, 'fraction_numerical': 0.015181518151815182, 'mean_word_length': 3.3688760806916425, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2608530', 'n_tokens_mistral': 667, 'n_tokens_neox': 637, 'n_words': 149}