<commit_before>package fetcher

import (
	"fmt"
	"os"
	"testing"

	"github.com/oinume/lekcije/server/model"
	"github.com/stretchr/testify/assert"
)

var _ = fmt.Print

func TestFetch(t *testing.T) {
	assert := assert.New(t)
	fetcher := NewTeacherLessonFetcher(nil, nil)
	teacher, _, err := fetcher.Fetch(1523)
	assert.NoError(err)
	assert.Equal("Crizelle", teacher.Name)
}

func TestParseHtml(t *testing.T) {
	assert := assert.New(t)
	fetcher := NewTeacherLessonFetcher(nil, nil)
	file, err := os.Open("testdata/5982.html")
	assert.NoError(err)
	defer file.Close()

	teacher, lessons, err := fetcher.parseHtml(model.NewTeacher(uint32(5982)), file)
	assert.Equal("Xai", teacher.Name)
	assert.True(len(lessons) > 0)
	for _, lesson := range lessons {
		if lesson.Status == "reservable" {

		}
	}
	//fmt.Printf("%v\n", spew.Sdump(lessons))
}
<commit_msg>Improve parseHtml test<commit_after>package fetcher

import (
	"fmt"
	"os"
	"testing"

	"github.com/oinume/lekcije/server/model"
	"github.com/stretchr/testify/assert"
)

var _ = fmt.Print

func TestFetch(t *testing.T) {
	assert := assert.New(t)
	fetcher := NewTeacherLessonFetcher(nil, nil)
	teacher, _, err := fetcher.Fetch(1523)
	assert.NoError(err)
	assert.Equal("Crizelle", teacher.Name)
}

func TestParseHtml(t *testing.T) {
	assert := assert.New(t)
	fetcher := NewTeacherLessonFetcher(nil, nil)
	file, err := os.Open("testdata/5982.html")
	assert.NoError(err)
	defer file.Close()

	teacher, lessons, err := fetcher.parseHtml(model.NewTeacher(uint32(5982)), file)
	assert.Equal("Xai", teacher.Name)
	assert.True(len(lessons) > 0)
	for _, lesson := range lessons {
		if lesson.Datetime.Format("2006-01-02 15:04") == "2016-07-01 11:00" {
			assert.Equal("Finished", lesson.Status)
		}
		if lesson.Datetime.Format("2006-01-02 15:04") == "2016-07-01 16:30" {
			assert.Equal("Reservable", lesson.Status)
		}
		if lesson.Datetime.Format("2006-01-02 15:04") == "2016-07-01 18:00" {
			assert.Equal("Reserved", lesson.Status)
		}
	}
	//fmt.Printf("%v\n", spew.Sdump(lessons))
}

{'fraction_non_alphanumeric': 0.17374136229022705, 'fraction_numerical': 0.050345508390918066, 'mean_word_length': 4.662011173184357, 'pattern_counts': {'":': 0, '<': 3, '<?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': '7533197', 'n_tokens_mistral': 895, 'n_tokens_neox': 810, 'n_words': 132}