示例#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)
示例#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)
示例#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)
示例#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)
示例#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)
示例#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)
示例#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)
示例#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__()
示例#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(""))
示例#10
0
 def test_types(self):
     """Verify different types are not equal."""
     self.assertNotEqual(Title("Title"), "Title")
示例#11
0
 def test_articles(self):
     """Verify articles are ignored when compare song titles."""
     self.assertEqual(Title("The song name"), Title("Song  Name"))
示例#12
0
 def test_case(self):
     """Verify song title case does not matter."""
     self.assertEqual(Title("Song Title"), Title("Song title"))
示例#13
0
 def test_alternate(self):
     """Verify alternate titles do not match."""
     self.assertNotEqual(Title("Song Name (Original)"),
                         Title("Song Name (Reprise)"))
示例#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)"))
示例#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)))
示例#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)))
示例#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)))
示例#18
0
 def test_featuring(self):
     """Verify featured artists do not matter for comparison."""
     self.assertEqual(Title("Title"), Title("Title (featuring Someone)"))
示例#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]"))
示例#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)
示例#21
0
 def test_different(self):
     """Verify different song titles are not equal."""
     self.assertNotEqual(Title("Title A"), Title("Title B"))
示例#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)))
示例#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)"))
示例#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)))
示例#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)"))