<commit_before>package cache

import (
	"errors"
	"testing"
)

func TestMultiLevelCache(t *testing.T) {
	c := MultiLevel{0: make(DummyCache), 1: make(DummyCache), 2: make(DummyCache)}

	checkInternal := func(p string, failDesc string) {
		for i := 0; i <= 2; i++ {
			_, err := c[i].Get(p, nil)
			if err != nil {
				t.Error(failDesc)
				t.Errorf("Cache level %d does not have %s", i, p)
			}
		}
	}

	o := simpleObject(8)

	c.Set("abc", o)
	checkInternal("abc", "Item was not added to all levels")

	c[1].Del("abc")
	c[2].Del("abc")
	_, err := c.Get("abc", nil)
	if err != nil {
		t.Error("Purging lower levels caused get failure")
	}

	_, err = c[1].Get("abc", nil)
	if err == nil {
		t.Error("Get filled in lower levels of cache")
	}

	c.Set("abc", o)
	checkInternal("abc", "Set with already existing item did not fill in lower levels")

	c[0].Del("abc")
	_, err = c.Get("abc", nil)
	if err != nil {
		t.Error("Get failed after first level cache purged object")
	}

	c.Del("abc")
	_, err = c.Get("abc", nil)
	if err == nil {<commit_msg>Additional test<commit_after>package cache

import (
	"errors"
	"testing"
)

func TestMultiLevelCache(t *testing.T) {
	c := MultiLevel{0: make(DummyCache), 1: make(DummyCache), 2: make(DummyCache)}

	checkInternal := func(p string, failDesc string) {
		for i := 0; i <= 2; i++ {
			_, err := c[i].Get(p, nil)
			if err != nil {
				t.Error(failDesc)
				t.Errorf("Cache level %d does not have %s", i, p)
			}
		}
	}

	o := simpleObject(8)

	c.Set("abc", o)
	checkInternal("abc", "Item was not added to all levels")

	c[1].Del("abc")
	c[2].Del("abc")
	_, err := c.Get("abc", nil)
	if err != nil {
		t.Error("Purging lower levels caused get failure")
	}

	_, err = c[1].Get("abc", nil)
	if err == nil {
		t.Error("Get filled in lower levels of cache")
	}

	c.Set("abc", o)
	checkInternal("abc", "Set with already existing item did not fill in lower levels")

	c[0].Del("abc")
	_, err = c.Get("abc", nil)
	if err != nil {
		t.Error("Get failed after first level cache purged object")
	}
	checkInternal("abc", "Get did not fill in inner cache")

	c.Del("abc")
	_, err = c.Get("abc", nil)
	if err == nil {
{'fraction_non_alphanumeric': 0.18262494161606727, 'fraction_numerical': 0.009341429238673517, 'mean_word_length': 3.528541226215645, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5751714', 'n_tokens_mistral': 877, 'n_tokens_neox': 815, 'n_words': 243}