<commit_before>// Copyright 2012 <NAME>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package reddit

import (
	//"fmt"
	"testing"
)

func TestPublicAPI(t *testing.T) {
	sub, err := AboutSubreddit("golang")
	if err != nil {
		t.Fatal(err)
	}
	if sub.FullId != "t5_2rc7j" {
		t.Fatalf("Subreddit id: %s, Expected: t5_2rc7j", sub.FullId)
	}

	_, err = DefaultHeadlines()
	if err != nil {
		t.Fatal(err)
	}
	_, err = SubredditHeadlines("golang")
	if err != nil {
		t.Fatal(err)
	}

	me, err := AboutRedditor("jzelinskie")
	if err != nil {
		t.Fatal(err)
	}
	if me.Id != "5pi0h" {
		t.Fatalf("Redditor id: %s, Expected: 5pi0h", me.Id)
	}
}

func TestAuthenticatedAPI(t *testing.T) {
	// Disable ssl certificate verification
	sesh, err := Login("goreddittest", "test", false)
	if err != nil {
		t.Fatal(err)
	}

	_, err = sesh.Me()
	if err != nil {
		t.Fatal(err)
	}

	hl, err := DefaultHeadlines()
	if err != nil {
		t.Fatal(err)
	}
	err = sesh.VoteHeadline(hl[0], UpVote)
	if err != nil {
		t.Fatal(err)
	}
	err = sesh.Clear("test")
	if err != nil {
		t.Fatal(err)
	}
}
<commit_msg>Added SortedHeadlines, reflected Session changes<commit_after>// Copyright 2012 <NAME>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package reddit

import (
	//"fmt"
	"testing"
)

func TestPublicAPI(t *testing.T) {
	sub, err := AboutSubreddit("golang")
	if err != nil {
		t.Fatal(err)
	}
	if sub.FullId != "t5_2rc7j" {
		t.Fatalf("Subreddit id: %s, Expected: t5_2rc7j", sub.FullId)
	}

	_, err = DefaultHeadlines()
	if err != nil {
		t.Fatal(err)
	}
	_, err = SubredditHeadlines("golang")
	if err != nil {
		t.Fatal(err)
	}

	_, err = SortedHeadlines("golang", NewHeadlines, DefaultAge)
	if err != nil {
		t.Fatal(err)
	}

	me, err := AboutRedditor("jzelinskie")
	if err != nil {
		t.Fatal(err)
	}
	if me.Id != "5pi0h" {
		t.Fatalf("Redditor id: %s, Expected: 5pi0h", me.Id)
	}
}

func TestAuthenticatedAPI(t *testing.T) {
	session := NewSession("goreddittest", "test", nil)
	err := session.Login()
	if err != nil {
		t.Fatal(err)
	}
	_, err = session.Me()
	if err != nil {
		t.Fatal(err)
	}

	hl, err := DefaultHeadlines()
	if err != nil {
		t.Fatal(err)
	}
	err = session.VoteHeadline(hl[0], UpVote)
	if err != nil {
		t.Fatal(err)
	}
	err = session.Clear("test")
	if err != nil {
		t.Fatal(err)
	}
}

{'fraction_non_alphanumeric': 0.16605316973415132, 'fraction_numerical': 0.012269938650306749, 'mean_word_length': 3.3368794326241136, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6563030', 'n_tokens_mistral': 1077, 'n_tokens_neox': 1017, 'n_words': 249}