import unittest import to_danmu 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 TestToDanmu(unittest.TestCase): def test_load_bv_numbers(self): bv_numbers = to_danmu.load_bv_numbers("E:/Crawler/else/bv_numbers.txt") self.assertIsInstance(bv_numbers, list) if __name__ == '__main__': unittest.main()