def test_8(self): from music_pet.utils import path_from_pattern PATTERN = u"/Users/normaluser/music_output/<%(prefix)s >%(album)s< (%(suffix)s)>/<<%(discnumber)s-%(tracknumber)s >%(title)s.flac" D = { u"album": u"看不懂到底有什么想法", u"title": u"有没有搞错", u"tracknumber": u"14", u"discnumber": u"3", u"prefix": u"精选集", u"suffix": u"限量版", } with self.assertRaises(ValueError): path_from_pattern(PATTERN, D)
def test_1(self): from music_pet.utils import path_from_pattern PATTERN = u"/Users/normaluser/music_output/<%(prefix)s >%(album)s< (%(suffix)s)>/<<%(discnumber)s->%(tracknumber)s >%(title)s.flac" D = { u"album": u"看不懂到底有什么想法", u"title": u"有没有搞错", } path = path_from_pattern(PATTERN, D) path_expected = u"/Users/normaluser/music_output/看不懂到底有什么想法/有没有搞错.flac" print(path) self.assertEqual(path, path_expected, "The result is not correct!")