<commit_before>package renamer

import (
    . "launchpad.net/gocheck"
)

func (s *MySuite) TestEpisodeStruct(c *C) {
    episode := Episode{season: 21, episode: 12, name: "Testepisode" }
    c.Check(episode.season, Equals, 21)
    c.Check(episode.CleanedFileName(), Equals, "S21E12 - Testepisode")

    episode = Episode{season: 1, episode: 1, name: "Testepisode" }
    c.Check(episode.CleanedFileName(), Equals, "S01E01 - Testepisode")
}

func (s *MySuite) TestEpisodeExtractionFromFile(c *C) {
    episode, err := CreateEpisodeFromPath(s.FileWithPath("crmi"))

    c.Check(err, IsNil)
    c.Check(episode, FitsTypeOf, new(Episode))
    c.Check(episode.season, Equals, 1)
    c.Check(episode.episode, Equals, 1)
    c.Check(episode.name, Equals, "Testtest mkv")
    c.Check(episode.series, Equals, "Criminal Minds")
}<commit_msg>Added tests for error handling in episode construction<commit_after>package renamer

import (
    . "launchpad.net/gocheck"
)

func (s *MySuite) TestEpisodeStruct(c *C) {
    episode := Episode{season: 21, episode: 12, name: "Testepisode" }
    c.Check(episode.season, Equals, 21)
    c.Check(episode.CleanedFileName(), Equals, "S21E12 - Testepisode")

    episode = Episode{season: 1, episode: 1, name: "Testepisode" }
    c.Check(episode.CleanedFileName(), Equals, "S01E01 - Testepisode")
}

func (s *MySuite) TestEpisodeExtractionFromFile(c *C) {
    episode, err := CreateEpisodeFromPath(s.FileWithPath("crmi"))

    c.Check(err, IsNil)
    c.Check(episode, Not(IsNil))
    c.Check(episode, FitsTypeOf, new(Episode))
    c.Check(episode.season, Equals, 1)
    c.Check(episode.episode, Equals, 1)
    c.Check(episode.name, Equals, "Testtest mkv")
    c.Check(episode.series, Equals, "Criminal Minds")
}

func (s *MySuite) TestEpisodeExtractionFromInvalidFile(c *C) {
    _, err := CreateEpisodeFromPath(s.FileWithPath("illegal1"))

    c.Check(err, ErrorMatches, "Supplied episode has no series information")
}

func (s *MySuite) TestEpisodeExtractionFromNotExistingFile(c *C) {
    _, err := CreateEpisodeFromPath("/should/not/exist")

    c.Check(err, ErrorMatches, "Supplied episode does not exist")
}
{'fraction_non_alphanumeric': 0.1421889616463985, 'fraction_numerical': 0.017305893358278764, 'mean_word_length': 4.5703125, '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': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4857348', 'n_tokens_mistral': 846, 'n_tokens_neox': 779, 'n_words': 160}