<commit_before>package atlas

import (
	"testing"
)

func TestSetAuth(t *testing.T) {

	SetAuth("foo")

	if APIKey != "foo" {
		t.Errorf("APIKey is not set")
	}
}

func TestWantAuth(t *testing.T) {

	var (
		key string
		ok bool
	)

	SetAuth("")
	if key, ok = HasAPIKey(); ok != false {
		t.Errorf("WantAuth() should be true")
	}

	SetAuth("foo")
	if key, ok = HasAPIKey(); ok != true {
		t.Errorf("ok should be true")
	}

	if key != "foo" {
		t.Errorf("APIKey should be %s but is %s", "foo", key)
	}
}

func TestGetPageNum(t *testing.T) {
	url := "https://foo.example.com/"

	n := getPageNum(url)
	if n != "" {
		t.Errorf("n=%s should be ''", n)
	}
	url = "https://foo.example.com/?page=42"
	n = getPageNum(url)
	if n != "42" {
		t.Errorf("n=%s should be 42", n)
	}
	url = "https://foo.example.com/?country=fr&page=43"
	n = getPageNum(url)
	if n != "43" {
		t.Errorf("n=%s should be 43", n)
	}
	url = "https://foo.example.com/?country=fr&page=666&bar=1"
	n = getPageNum(url)
	if n != "666" {
		t.Errorf("n=%s should be 666", n)
	}

	url = ""
	n = getPageNum(url)
	if n != "" {
		t.Errorf("n=%d should be ''", n)
	}
}
<commit_msg>Fix format string.<commit_after>package atlas

import (
	"testing"
)

func TestSetAuth(t *testing.T) {

	SetAuth("foo")

	if APIKey != "foo" {
		t.Errorf("APIKey is not set")
	}
}

func TestWantAuth(t *testing.T) {

	var (
		key string
		ok bool
	)

	SetAuth("")
	if key, ok = HasAPIKey(); ok != false {
		t.Errorf("WantAuth() should be true")
	}

	SetAuth("foo")
	if key, ok = HasAPIKey(); ok != true {
		t.Errorf("ok should be true")
	}

	if key != "foo" {
		t.Errorf("APIKey should be %s but is %s", "foo", key)
	}
}

func TestGetPageNum(t *testing.T) {
	url := "https://foo.example.com/"

	n := getPageNum(url)
	if n != "" {
		t.Errorf("n=%s should be ''", n)
	}
	url = "https://foo.example.com/?page=42"
	n = getPageNum(url)
	if n != "42" {
		t.Errorf("n=%s should be 42", n)
	}
	url = "https://foo.example.com/?country=fr&page=43"
	n = getPageNum(url)
	if n != "43" {
		t.Errorf("n=%s should be 43", n)
	}
	url = "https://foo.example.com/?country=fr&page=666&bar=1"
	n = getPageNum(url)
	if n != "666" {
		t.Errorf("n=%s should be 666", n)
	}

	url = ""
	n = getPageNum(url)
	if n != "" {
		t.Errorf("n=%s should be ''", n)
	}
}

{'fraction_non_alphanumeric': 0.21147902869757174, 'fraction_numerical': 0.019426048565121413, 'mean_word_length': 3.180811808118081, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 8, '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': '3571121', 'n_tokens_mistral': 1057, 'n_tokens_neox': 978, 'n_words': 232}