@@ -43,59 +43,6 @@ def test_batch(self):
4343 ret2 = jmcomic .download_album ((e for e in album_ls ), self .option )
4444 self .assertEqual (len (ret2 ), len (album_ls ), 'Generator' )
4545
46- def test_photo_sort (self ):
47- client = self .option .build_jm_client ()
48-
49- # 测试用例 - 单章本子
50- single_photo_album_is = str_to_list ('''
51- 430371
52- 438696
53- 432888
54- ''' )
55-
56- # 测试用例 - 多章本子
57- multi_photo_album_is = str_to_list ('''
58- 400222
59- 122061
60- ''' )
61-
62- photo_dict : Dict [str , JmPhotoDetail ] = multi_call (client .get_photo_detail , single_photo_album_is )
63- album_dict : Dict [str , JmAlbumDetail ] = multi_call (client .get_album_detail , single_photo_album_is )
64-
65- for each in photo_dict .values ():
66- each : JmPhotoDetail
67- self .assertEqual (each .album_index , 1 )
68-
69- for each in album_dict .values ():
70- each : JmAlbumDetail
71- self .assertEqual (each [0 ].album_index , 1 )
72-
73- print_eye_catching ('【通过】测试用例 - 单章本子' )
74- multi_photo_album_dict : Dict [JmAlbumDetail , List [JmPhotoDetail ]] = {}
75-
76- def run (aid ):
77- album = client .get_album_detail (aid )
78-
79- photo_dict = multi_call (
80- client .get_photo_detail ,
81- (photo .photo_id for photo in album ),
82- launcher = thread_pool_executor ,
83- )
84-
85- multi_photo_album_dict [album ] = list (photo_dict .values ())
86-
87- multi_thread_launcher (
88- iter_objs = multi_photo_album_is ,
89- apply_each_obj_func = run ,
90- )
91-
92- for album , photo_ls in multi_photo_album_dict .items ():
93- self .assertListEqual (
94- sorted ([each .sort for each in album ]),
95- sorted ([ans .sort for ans in photo_ls ]),
96- album .album_id
97- )
98-
9946 def test_get_jmcomic_url (self ):
10047 func_list = {
10148 self .client .get_jmcomic_url ,
@@ -125,80 +72,3 @@ def run_func_async(func):
12572 print (e )
12673
12774 raise AssertionError (exception_list )
128-
129- def test_getitem_and_slice (self ):
130- cl : JmcomicClient = self .client
131- cases = [
132- ['400222' , 0 , [400222 ]],
133- ['400222' , 1 , [413446 ]],
134- ['400222' , (None , 1 ), [400222 ]],
135- ['400222' , (1 , 3 ), [413446 , 413447 ]],
136- ['413447' , (1 , 3 ), [2 , 3 ], []],
137- ]
138-
139- for [jmid , slicearg , * args ] in cases :
140- ans = args [0 ]
141-
142- if len (args ) == 1 :
143- func = cl .get_album_detail
144- else :
145- func = cl .get_photo_detail
146-
147- jmentity = func (jmid )
148-
149- ls : List [Union [JmPhotoDetail , JmImageDetail ]]
150- if isinstance (slicearg , int ):
151- ls = [jmentity [slicearg ]]
152- elif len (slicearg ) == 2 :
153- ls = jmentity [slicearg [0 ]: slicearg [1 ]]
154- else :
155- ls = jmentity [slicearg [0 ]: slicearg [1 ]: slicearg [2 ]]
156-
157- if len (args ) == 1 :
158- self .assertListEqual (
159- list1 = [int (e .id ) for e in ls ],
160- list2 = ans ,
161- )
162- else :
163- self .assertListEqual (
164- list1 = [int (e .img_file_name ) for e in ls ],
165- list2 = ans ,
166- )
167-
168- def test_search_advanced (self ):
169- elist = []
170-
171- def search_and_test (expected_result , params ):
172- try :
173- page = self .client .search_site (** params )
174- print (page )
175- assert int (page [0 ][0 ]) == expected_result
176- except Exception as e :
177- elist .append (e )
178-
179- # 定义测试用例
180- cases = {
181- 152637 : {
182- 'search_query' : '无修正' ,
183- 'order_by' : JmSearchAlbumClient .ORDER_BY_LIKE ,
184- 'time' : JmSearchAlbumClient .TIME_ALL ,
185- },
186- 147643 : {
187- 'search_query' : '无修正' ,
188- 'order_by' : JmSearchAlbumClient .ORDER_BY_PICTURE ,
189- 'time' : JmSearchAlbumClient .TIME_ALL ,
190- },
191- }
192-
193- multi_thread_launcher (
194- iter_objs = cases .items (),
195- apply_each_obj_func = search_and_test ,
196- )
197-
198- if len (elist ) == 0 :
199- return
200-
201- for e in elist :
202- print (e )
203-
204- raise AssertionError (elist )
0 commit comments