You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
693 B
26 lines
693 B
import unittest
|
|
import bvid
|
|
import os
|
|
import sys
|
|
# 获取当前文件所在目录的绝对路径
|
|
current_dir = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
# 获取 developed_code 目录的绝对路径,并添加到 sys.path 中
|
|
developed_code_path = os.path.abspath(os.path.join(current_dir, '..'))
|
|
sys.path.append(developed_code_path)
|
|
|
|
|
|
class TestBvid(unittest.TestCase):
|
|
|
|
def test_get_source(self):
|
|
source = bvid.get_source(1)
|
|
self.assertTrue('bvid' in source)
|
|
|
|
def test_extract_bv(self):
|
|
html = '{"bvid":"test_bvid","title":"test"}'
|
|
bvs = bvid.extract_bv(html)
|
|
self.assertIn("test_bvid", bvs)
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|