<s> import unittest <EOL> from datetime import date <EOL> from tvrage . api import Show <EOL> from tvrage . exceptions import ( ShowHasEnded , FinaleMayNotBeAnnouncedYet , <EOL> ShowNotFound ) <EOL> class ShowTest ( unittest . TestCase ) : <EOL> show = Show ( '<STR_LIT>' ) <EOL> dead_show = Show ( '<STR_LIT>' ) <EOL> def test_show_still_running ( self ) : <EOL> assert self . show . ended == <NUM_LIT:0> <EOL> def test_get_season ( self ) : <EOL> season = self . show . season ( <NUM_LIT:1> ) <EOL> assert len ( season ) == <NUM_LIT> <EOL> assert season . episode ( <NUM_LIT:1> ) . title == '<STR_LIT>' <EOL> def test_get_next_episode_from_dead_show ( self ) : <EOL> try : <EOL> self . dead_show . next_episode <EOL> except Exception , e : <EOL> assert isinstance ( e , ShowHasEnded ) <EOL> def test_get_pilot ( self ) : <EOL> p = self . show . pilot <EOL> assert p . season == <NUM_LIT:1> <EOL> assert p . number == <NUM_LIT:1> <EOL> assert p . title == '<STR_LIT>' <EOL> def test_get_current_season_from_dead_show ( self ) : <EOL> try : <EOL> self . dead_show . current_season <EOL> except Exception , e : <EOL> assert isinstance ( e , ShowHasEnded ) <EOL> def test_get_upcoming_eps ( self ) : <EOL> today = date . today ( ) <EOL> for ep in self . show . upcoming_episodes : <EOL> airdate = ep . airdate <EOL> assert airdate >= today <EOL> def test_get_latest_ep ( self ) : <EOL> today = date . today ( ) <EOL> ep = Show ( '<STR_LIT>' ) . latest_episode <EOL> assert ep . airdate <= today <EOL> assert ep . title == '<STR_LIT>' <EOL> def test_non_existant_show_raises_proper_exception ( self ) : <EOL> try : <EOL> Show ( '<STR_LIT>' ) <EOL> except Exception , e : <EOL> assert isinstance ( e , ShowNotFound ) <EOL> assert e . value == '<STR_LIT>' <EOL> def test_synopsis ( self ) : <EOL> assert self . dead_show . synopsis . startswith ( <EOL> u"<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> def test_show_with_missing_seasons_doesnt_mess_up_season_count ( self ) : <EOL> s = Show ( u'<STR_LIT>' ) <EOL> assert s . seasons >= <NUM_LIT> <EOL> class SeasonTest ( unittest . TestCase ) : <EOL> season = Show ( '<STR_LIT>' ) . season ( <NUM_LIT:3> ) <EOL> def test_get_episode ( self ) : <EOL> assert self . season . episode ( <NUM_LIT:1> ) . number == <NUM_LIT:1> <EOL> assert self . season . episode ( <NUM_LIT:6> ) . number == <NUM_LIT:6> <EOL> assert self . season . episode ( <NUM_LIT> ) . number == <NUM_LIT> <EOL> def test_get_premiere ( self ) : <EOL> ep = self . season . premiere <EOL> assert ep . number == <NUM_LIT:1> <EOL> def test_get_finale ( self ) : <EOL> assert self . season . finale . number == <NUM_LIT> <EOL> try : <EOL> Show ( '<STR_LIT>' ) . current_season . finale <EOL> except Exception , e : <EOL> assert isinstance ( e , FinaleMayNotBeAnnouncedYet ) <EOL> class EpisodeTest ( unittest . TestCase ) : <EOL> ep = Show ( '<STR_LIT>' ) . season ( <NUM_LIT:3> ) . episode ( <NUM_LIT:6> ) <EOL> def test_show ( self ) : <EOL> assert self . ep . show == '<STR_LIT>' <EOL> def test_season ( self ) : <EOL> assert self . ep . season == <NUM_LIT:3> <EOL> def test_num ( self ) : <EOL> assert self . ep . number == <NUM_LIT:6> <EOL> def test_airdate ( self ) : <EOL> assert self . ep . airdate == date ( <NUM_LIT> , <NUM_LIT:11> , <NUM_LIT:0> <NUM_LIT:7> ) <EOL> def test_title ( self ) : <EOL> assert self . ep . title == '<STR_LIT>' <EOL> def test_link ( self ) : <EOL> assert self . ep . link == '<STR_LIT>' <EOL> def test_summary_old ( self ) : <EOL> s = "<STR_LIT>" "<STR_LIT>" "<STR_LIT>" "<STR_LIT>" "<STR_LIT>" "<STR_LIT>" "<STR_LIT>" <EOL> assert self . ep . summary == s <EOL> def test_summary_new ( self ) : <EOL> ep = Show ( '<STR_LIT>' ) . season ( <NUM_LIT:1> ) . episode ( <NUM_LIT:8> ) <EOL> s = '<STR_LIT>' '<STR_LIT>' '<STR_LIT>' <EOL> assert ep . summary == s <EOL> def test_recap_url ( self ) : <EOL> ep = Show ( '<STR_LIT>' ) . season ( <NUM_LIT:1> ) . episode ( <NUM_LIT:1> ) <EOL> s = '<STR_LIT>' <EOL> assert ep . recap_url == s <EOL> def test_id ( self ) : <EOL> assert self . ep . id == '<STR_LIT>' <EOL> def test_recap ( self ) : <EOL> ep = Show ( '<STR_LIT>' ) . season ( <NUM_LIT:1> ) . episode ( <NUM_LIT:1> ) <EOL> s = '<STR_LIT>' '<STR_LIT>' <EOL> assert s in ep . recap <EOL> def test_recap_negativ ( self ) : <EOL> ep = Show ( '<STR_LIT>' ) . season ( <NUM_LIT:3> ) . episode ( <NUM_LIT:6> ) <EOL> assert ep . recap == '<STR_LIT>' <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
