-
Notifications
You must be signed in to change notification settings - Fork 807
/
test_metainfo.py
35 lines (30 loc) · 1.19 KB
/
test_metainfo.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
# -*- coding: utf-8 -*-
from pathlib import Path
from unittest import TestCase
from app.core.metainfo import MetaInfo, MetaInfoPath
from tests.cases.meta import meta_cases
class MetaInfoTest(TestCase):
def setUp(self) -> None:
pass
def tearDown(self) -> None:
pass
def test_metainfo(self):
for info in meta_cases:
if info.get("path"):
meta_info = MetaInfoPath(path=Path(info.get("path")))
else:
meta_info = MetaInfo(title=info.get("title"), subtitle=info.get("subtitle"))
target = {
"type": meta_info.type.value,
"cn_name": meta_info.cn_name or "",
"en_name": meta_info.en_name or "",
"year": meta_info.year or "",
"part": meta_info.part or "",
"season": meta_info.season,
"episode": meta_info.episode,
"restype": meta_info.edition,
"pix": meta_info.resource_pix or "",
"video_codec": meta_info.video_encode or "",
"audio_codec": meta_info.audio_encode or ""
}
self.assertEqual(target, info.get("target"))