-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_anime_parse.py
37 lines (27 loc) · 1.38 KB
/
test_anime_parse.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import unittest
from anime_parse import parse_file_name
class TestAnimeParse(unittest.TestCase):
def test_anime_parse_simple(self):
file_name = "Usagi Drop - OP - Sweet Drops"
res = parse_file_name(file_name)
self.assertEqual(res["title_music"], "Sweet Drops")
self.assertEqual(res["title_work"], "Usagi Drop")
self.assertEqual(res["link_type"], "OP")
def test_anime_parse_complex(self):
file_name = "ABC ~ okaeri - ED36 NSFW SPOIL AMV LONG INST COVER REMIX - Sweet Drops (ARTIST nyako - EP 1423-1532,1600 - VERS Dream - VIDEO Censored - AMV Beah - VTITLE seriously? - (Ultimate))"
res = parse_file_name(file_name)
self.assertEqual(res["title_work"], "ABC")
self.assertEqual(res["subtitle_work"], "okaeri")
self.assertEqual(res["link_type"], "ED")
self.assertEqual(res["link_nb"], 36)
self.assertCountEqual(
res["tags"], ["NSFW", "SPOIL", "AMV", "LONG", "INST", "COVER", "REMIX"]
)
self.assertEqual(res["title_music"], "Sweet Drops")
self.assertEqual(res["artists"], ["nyako"])
self.assertEqual(res["version"], "Dream")
self.assertEqual(res["detail_video"], "Censored, Beah, seriously?")
self.assertEqual(res["episodes"], "1423-1532,1600")
self.assertEqual(res["detail"], "Ultimate")
if __name__ == "__main__":
unittest.main()