Ejemplo n.º 1
0
 def test_featuring(self):
     """Verify a song with a featured artist can be parsed."""
     title = Title("Song Title (feat. Artist B)")
     self.assertEqual("Song Title", title.name)
     self.assertEqual(None, title.alternate)
     self.assertEqual(None, title.variant)
     self.assertEqual("Artist B", title.featuring)
Ejemplo n.º 2
0
 def test_combination2(self):
     """Verify a remixed song title can be parsed."""
     title = Title("Song Name (Reprise) [Remix]")
     self.assertEqual("Song Name", title.name)
     self.assertEqual("Reprise", title.alternate)
     self.assertEqual('Remix', title.variant)
     self.assertEqual(None, title.featuring)
Ejemplo n.º 3
0
 def test_remix(self):
     """Verify a remix can be parsed."""
     title = Title("Another Song [Super Remix]")
     self.assertEqual("Another Song", title.name)
     self.assertEqual(None, title.alternate)
     self.assertEqual('Remix', title.variant)
     self.assertEqual(None, title.featuring)
Ejemplo n.º 4
0
 def test_live(self):
     """Verify a live title can be parsed."""
     title = Title("Another Song (Live Extended Version)")
     self.assertEqual("Another Song", title.name)
     self.assertEqual(None, title.alternate)
     self.assertEqual('Live', title.variant)
     self.assertEqual(None, title.featuring)
Ejemplo n.º 5
0
 def test_alternate(self):
     """Verify an alternate title can be parsed."""
     title = Title("The Song Name (For Real)")
     self.assertEqual("The Song Name", title.name)
     self.assertEqual("For Real", title.alternate)
     self.assertEqual(None, title.variant)
     self.assertEqual(None, title.featuring)
Ejemplo n.º 6
0
 def test_nominal(self):
     """Verify a normal title can be parsed."""
     title = Title("The Song Name")
     self.assertEqual("The Song Name", title.name)
     self.assertEqual(None, title.alternate)
     self.assertEqual(None, title.variant)
     self.assertEqual(None, title.featuring)
Ejemplo n.º 7
0
 def test_combination(self):
     """Verify a combination song title can be parsed."""
     title = Title(
         "The Song Name (For Real) (Live Version) (feat. Artist B)")
     self.assertEqual("The Song Name", title.name)
     self.assertEqual("For Real", title.alternate)
     self.assertEqual('Live', title.variant)
     self.assertEqual("Artist B", title.featuring)
Ejemplo n.º 8
0
    def __init__(self, artist, title, album=None, year=None, track=None, duration=None):
        """Initialize a new song.

        @param artist: name of song's artist
        @param title: name song
        @param album: name of song's album
        @param year: year of song's album's release
        @param track: track number on album
        @param duration: length of song in seconds
        """
        self.title = Title(title)
        self.artist = Artist(artist)
        self.album = Album(album, year)
        self.track = self._parse_int(track, "track number")
        self.duration = self._parse_int(duration, "song duration")
        super(Song, self).__init__()
Ejemplo n.º 9
0
 def test_exact(self):
     """Verify exact song title matches are equal."""
     self.assertEqual(Title("Song Title"), Title("Song Title"))
     self.assertEqual(Title(""), Title(""))
Ejemplo n.º 10
0
 def test_types(self):
     """Verify different types are not equal."""
     self.assertNotEqual(Title("Title"), "Title")
Ejemplo n.º 11
0
 def test_articles(self):
     """Verify articles are ignored when compare song titles."""
     self.assertEqual(Title("The song name"), Title("Song  Name"))
Ejemplo n.º 12
0
 def test_case(self):
     """Verify song title case does not matter."""
     self.assertEqual(Title("Song Title"), Title("Song title"))
Ejemplo n.º 13
0
 def test_alternate(self):
     """Verify alternate titles do not match."""
     self.assertNotEqual(Title("Song Name (Original)"),
                         Title("Song Name (Reprise)"))
Ejemplo n.º 14
0
 def test_remixes(self):
     """Verify similarly labeled song title remixes are equal."""
     self.assertEqual(Title("Title (remix)"), Title("Title [Remix]"))
     self.assertEqual(Title("Title [Remix]"),
                      Title("Title (Dubstep Remix)"))
Ejemplo n.º 15
0
 def test_alternate(self):
     """Verify an alternate title can be formatted."""
     title = Title("The Song Name (For Real)")
     self.assertEqual("The Song Name (For Real)", str(title))
     self.assertEqual(title, eval(repr(title)))
Ejemplo n.º 16
0
 def test_remix(self):
     """Verify a remix can be formatted."""
     title = Title("Another Song [remix]")
     self.assertEqual("Another Song [Remix]", str(title))
     self.assertEqual(title, eval(repr(title)))
Ejemplo n.º 17
0
 def test_nominal(self):
     """Verify a normal title can be formatted."""
     title = Title("The Song Name")
     self.assertEqual("The Song Name", str(title))
     self.assertEqual(title, eval(repr(title)))
Ejemplo n.º 18
0
 def test_featuring(self):
     """Verify featured artists do not matter for comparison."""
     self.assertEqual(Title("Title"), Title("Title (featuring Someone)"))
Ejemplo n.º 19
0
 def test_bonus_track(self):
     """Verify "bonus tracks" are equal."""
     self.assertEqual(Title("Song Title"),
                      Title("Song Title (Bonus Track)"))
     self.assertEqual(Title("Song Title"),
                      Title("Song Title [Bonus Track]"))
Ejemplo n.º 20
0
 def test_similar_titles(self):
     """Verify titles containing keywords are not accidentally matched."""
     self.assertEqual(None, Title("Song (Alive)").variant)
     self.assertEqual(None, Title("Want to Live").variant)
Ejemplo n.º 21
0
 def test_different(self):
     """Verify different song titles are not equal."""
     self.assertNotEqual(Title("Title A"), Title("Title B"))
Ejemplo n.º 22
0
 def test_featuring(self):
     """Verify a song with a featured artist can be formatted."""
     title = Title("Song Title (feat. Artist B)")
     self.assertEqual("Song Title", str(title))
     self.assertEqual(title, eval(repr(title)))
Ejemplo n.º 23
0
 def test_live(self):
     """Verify a live song title does not match the original."""
     self.assertNotEqual(Title("Title"), Title("Title [Live]"))
     self.assertNotEqual(Title("Title"), Title("Title (live)"))
Ejemplo n.º 24
0
 def test_live(self):
     """Verify a live song can be formatted."""
     title = Title("Another Song (Live)")
     self.assertEqual("Another Song [Live]", str(title))
     self.assertEqual(title, eval(repr(title)))
Ejemplo n.º 25
0
 def test_live_remix(self):
     """Verify a live remix does match a normal remix."""
     self.assertNotEqual(Title("Song Name [Remix]"),
                         Title("Song Name (Live Remix)"))