@@ -57,16 +57,16 @@ def test_library_search(library, generate_tag, entry_full):
5757 assert library .entries_count == 2
5858 tag = list (entry_full .tags )[0 ]
5959
60- query_count , items = library .search_library (
60+ results = library .search_library (
6161 FilterState (
6262 tag = tag .name ,
6363 ),
6464 )
6565
66- assert query_count == 1
67- assert len (items ) == 1
66+ assert results . total_count == 1
67+ assert len (results ) == 1
6868
69- entry = items [0 ]
69+ entry = results [0 ]
7070 assert {x .name for x in entry .tags } == {
7171 "foo" ,
7272 }
@@ -94,9 +94,9 @@ def test_tag_search(library):
9494
9595def test_get_entry (library , entry_min ):
9696 assert entry_min .id
97- cnt , entries = library .search_library (FilterState (id = entry_min .id ))
98- assert len (entries ) == cnt == 1
99- assert entries [0 ].tags
97+ results = library .search_library (FilterState (id = entry_min .id ))
98+ assert len (results ) == results . total_count == 1
99+ assert results [0 ].tags
100100
101101
102102def test_entries_count (library ):
@@ -105,14 +105,14 @@ def test_entries_count(library):
105105 for x in range (10 )
106106 ]
107107 library .add_entries (entries )
108- matches , page = library .search_library (
108+ results = library .search_library (
109109 FilterState (
110110 page_size = 5 ,
111111 )
112112 )
113113
114- assert matches == 12
115- assert len (page ) == 5
114+ assert results . total_count == 12
115+ assert len (results ) == 5
116116
117117
118118def test_add_field_to_entry (library ):
@@ -146,8 +146,8 @@ def test_add_field_tag(library, entry_full, generate_tag):
146146 library .add_field_tag (entry_full , tag , tag_field .type_key )
147147
148148 # Then
149- _ , entries = library .search_library (FilterState (id = entry_full .id ))
150- tag_field = entries [0 ].tag_box_fields [0 ]
149+ results = library .search_library (FilterState (id = entry_full .id ))
150+ tag_field = results [0 ].tag_box_fields [0 ]
151151 assert [x .name for x in tag_field .tags if x .name == tag_name ]
152152
153153
@@ -179,15 +179,15 @@ def test_search_filter_extensions(library, is_exclude):
179179 library .set_prefs (LibraryPrefs .EXTENSION_LIST , ["md" ])
180180
181181 # When
182- query_count , items = library .search_library (
182+ results = library .search_library (
183183 FilterState (),
184184 )
185185
186186 # Then
187- assert query_count == 1
188- assert len (items ) == 1
187+ assert results . total_count == 1
188+ assert len (results ) == 1
189189
190- entry = items [0 ]
190+ entry = results [0 ]
191191 assert (entry .path .suffix == ".txt" ) == is_exclude
192192
193193
@@ -200,15 +200,15 @@ def test_search_library_case_insensitive(library):
200200 tag = list (entry .tags )[0 ]
201201
202202 # When
203- query_count , items = library .search_library (
203+ results = library .search_library (
204204 FilterState (tag = tag .name .upper ()),
205205 )
206206
207207 # Then
208- assert query_count == 1
209- assert len (items ) == 1
208+ assert results . total_count == 1
209+ assert len (results ) == 1
210210
211- assert items [0 ].id == entry .id
211+ assert results [0 ].id == entry .id
212212
213213
214214def test_preferences (library ):
@@ -231,11 +231,11 @@ def test_save_windows_path(library, generate_tag):
231231 # library.add_tag(tag)
232232 library .add_field_tag (entry , tag , create_field = True )
233233
234- _ , found = library .search_library (FilterState (tag = tag_name ))
235- assert found
234+ results = library .search_library (FilterState (tag = tag_name ))
235+ assert results
236236
237237 # path should be saved in posix format
238- assert str (found [0 ].path ) == "foo/bar.txt"
238+ assert str (results [0 ].path ) == "foo/bar.txt"
239239
240240
241241def test_remove_entry_field (library , entry_full ):
@@ -312,13 +312,13 @@ def test_mirror_entry_fields(library, entry_full):
312312
313313 entry_id = library .add_entries ([target_entry ])[0 ]
314314
315- _ , entries = library .search_library (FilterState (id = entry_id ))
316- new_entry = entries [0 ]
315+ results = library .search_library (FilterState (id = entry_id ))
316+ new_entry = results [0 ]
317317
318318 library .mirror_entry_fields (new_entry , entry_full )
319319
320- _ , entries = library .search_library (FilterState (id = entry_id ))
321- entry = entries [0 ]
320+ results = library .search_library (FilterState (id = entry_id ))
321+ entry = results [0 ]
322322
323323 assert len (entry .fields ) == 4
324324 assert {x .type_key for x in entry .fields } == {
@@ -350,13 +350,11 @@ def test_remove_tag_from_field(library, entry_full):
350350 ],
351351)
352352def test_search_file_name (library , query_name , has_result ):
353- res_count , items = library .search_library (
353+ results = library .search_library (
354354 FilterState (name = query_name ),
355355 )
356356
357- assert (
358- res_count == has_result
359- ), f"mismatch with query: { query_name } , result: { res_count } "
357+ assert results .total_count == has_result
360358
361359
362360@pytest .mark .parametrize (
@@ -369,13 +367,11 @@ def test_search_file_name(library, query_name, has_result):
369367 ],
370368)
371369def test_search_entry_id (library , query_name , has_result ):
372- res_count , items = library .search_library (
370+ results = library .search_library (
373371 FilterState (id = query_name ),
374372 )
375373
376- assert (
377- res_count == has_result
378- ), f"mismatch with query: { query_name } , result: { res_count } "
374+ assert results .total_count == has_result
379375
380376
381377def test_update_field_order (library , entry_full ):
0 commit comments