def test_episode_no_name_no_ext(): # type: () -> None """EpisodeInfo with no name or extension """ ep = EpisodeInfo(seriesname='Scrubs', seasonnumber=1, episodenumbers=[2], episodename=None, filename=None) assertEquals(ep.generate_filename(), 'Scrubs - [01x02]')
def test_no_name(): # type: () -> None """Episode without a name """ ep = EpisodeInfo(seriesname='Scrubs', seasonnumber=1, episodenumbers=[2], episodename=None, filename='scrubs.example.file.avi') assertEquals(ep.generate_filename(), 'Scrubs - [01x02].avi')
def test_simple_no_ext(): # type: () -> None """Simple episode with out extension """ ep = EpisodeInfo(seriesname='Scrubs', seasonnumber=1, episodenumbers=[2], episodename=['My Mentor'], filename=None) assertEquals(ep.generate_filename(), 'Scrubs - [01x02] - My Mentor')
def test_single_episode(): # type: () -> None """Simple episode name, with show/season/episode/name/filename """ ep = EpisodeInfo(seriesname='Scrubs', seasonnumber=1, episodenumbers=[2], episodename=['My Mentor'], filename='scrubs.example.file.avi') assertEquals(ep.generate_filename(), 'Scrubs - [01x02] - My Mentor.avi')
def test_episode_numeric_title(): # type: () -> None """An episode with a name starting with a number should not be detected as a range """ ep = EpisodeInfo(seriesname='Star Trek TNG', seasonnumber=1, episodenumbers=[15], episodename=['11001001'], filename='STTNG-S01E15-11001001.avi') assertEquals(ep.generate_filename(), 'Star Trek TNG - [01x15] - 11001001.avi')
def test_multi_episodes_continuous(): # type: () -> None """A two-part episode should not have the episode name repeated """ ep = EpisodeInfo( seriesname='Stargate SG-1', seasonnumber=1, episodenumbers=[1, 2], episodename=['Children of the Gods (1)', 'Children of the Gods (2)'], filename='stargate.example.file.avi') assertEquals( ep.generate_filename(), 'Stargate SG-1 - [01x01-02] - Children of the Gods (1-2).avi')
def test_multi_episodes_seperate(): # type: () -> None """File with two episodes, but with different names """ ep = EpisodeInfo( seriesname='Stargate SG-1', seasonnumber=1, episodenumbers=[2, 3], episodename=['Children of the Gods (2)', 'The Enemy Within'], filename='stargate.example.file.avi') assertEquals( ep.generate_filename(), 'Stargate SG-1 - [01x02-03] - Children of the Gods (2), The Enemy Within.avi' )
def verify_name_gen(curtest, tvdb_instance): # type: (Any, Tvdb) -> None if "seasonnumber" in curtest: ep = EpisodeInfo(seriesname=curtest['parsedseriesname'], seasonnumber=curtest['seasonnumber'], episodenumbers=curtest['episodenumbers']) elif any([isinstance(x, datetime.date) for x in curtest['episodenumbers']]): ep = DatedEpisodeInfo(seriesname=curtest['parsedseriesname'], episodenumbers=curtest['episodenumbers']) else: ep = NoSeasonEpisodeInfo(seriesname=curtest['parsedseriesname'], episodenumbers=curtest['episodenumbers']) ep.populate_from_tvdb(tvdb_instance, force_name=curtest.get("force_name")) assert ep.seriesname is not None, "Corrected series name was none" assert ep.episodename is not None, "Episode name was None" assertEquals(ep.seriesname, curtest['correctedseriesname']) assertEquals(ep.episodename, curtest['episodenames'])