def test_is_dupe(self): with tvservice.episodes_db() as db: episodes = db # Episode titles have to be exact to not be a dupe self.assertTrue(tvservice.episode_is_dupe(episodes, "How I Met Your Father", "S01E04", "How I Met your father S01E04 720P")) self.assertTrue(tvservice.episode_is_dupe(episodes, "Fact Provers", "S01E03", "Fact provers S01E03 720P")) # Episode quality has to be exact self.assertTrue(tvservice.episode_is_dupe(episodes, "How I Met Your Father", "S01E04", "How I Met your Father S01E04 1080P")) self.assertTrue(tvservice.episode_is_dupe(episodes, "Fact Provers", "S01E03", "Fact Provers S01E03 1080P")) # Episode slug has to be exact self.assertTrue(tvservice.episode_is_dupe(episodes, "How I Met Your Father", "S01E05", "How I Met your Father S01E05 720P")) self.assertTrue(tvservice.episode_is_dupe(episodes, "Fact Provers", "S01E04", "Fact Provers S01E04 720P"))
def setUp(self): # Create an inital episodes structure with tvservice.episodes_db() as episodes: # Mark two episodes as seen episodes = tvservice.episode_seen(episodes, "How I Met Your Father", "S01E04", "How I Met your Father S01E04 720P") episodes = tvservice.episode_seen(episodes, "Fact Provers", "S01E03", "Fact Provers S01E03 720P")
def test_is_not_dupe(self): with tvservice.episodes_db() as db: episodes = db # Episode titles have to be exact to not be a dupe self.assertFalse(tvservice.episode_is_dupe(episodes, "How I Met Your Father", "S01E04", "How I Met your Father S01E04 720P")) self.assertFalse(tvservice.episode_is_dupe(episodes, "Fact Provers", "S01E03", "Fact Provers S01E03 720P")) # Any unknown episode is obviously not a dupe self.assertFalse(tvservice.episode_is_dupe(episodes, "Inspector Spacetime", "S01E03", "Inspector Spacetime S01E03 720P"))