mirror of
https://github.com/TagStudioDev/TagStudio.git
synced 2026-02-10 20:02:29 +00:00
feat: replace extension exclusion system with .ts_ignore (#1046)
* feat: replace extension exclusion with ts_ignore
This commit is contained in:
committed by
GitHub
parent
44c7d223ff
commit
8e1ae81ec9
@@ -134,7 +134,7 @@ def test_title_update(
|
||||
menu_bar = QMenuBar()
|
||||
|
||||
qt_driver.main_window.menu_bar.open_recent_library_menu = QMenu(menu_bar)
|
||||
qt_driver.main_window.menu_bar.manage_file_ext_action = QAction(menu_bar)
|
||||
qt_driver.main_window.menu_bar.ignore_modal_action = QAction(menu_bar)
|
||||
qt_driver.main_window.menu_bar.save_library_backup_action = QAction(menu_bar)
|
||||
qt_driver.main_window.menu_bar.close_library_action = QAction(menu_bar)
|
||||
qt_driver.main_window.menu_bar.refresh_dir_action = QAction(menu_bar)
|
||||
|
||||
@@ -178,27 +178,6 @@ def test_remove_tag(library: Library, generate_tag: Callable[..., Tag]):
|
||||
assert len(library.tags) == tag_count - 1
|
||||
|
||||
|
||||
@pytest.mark.parametrize("is_exclude", [True, False])
|
||||
def test_search_filter_extensions(library: Library, is_exclude: bool):
|
||||
# Given
|
||||
entries = list(library.all_entries())
|
||||
assert len(entries) == 2, entries
|
||||
|
||||
library.set_prefs(LibraryPrefs.IS_EXCLUDE_LIST, is_exclude)
|
||||
library.set_prefs(LibraryPrefs.EXTENSION_LIST, ["md"])
|
||||
|
||||
# When
|
||||
results = library.search_library(BrowsingState.show_all(), page_size=500)
|
||||
entries = library.get_entries(results.ids)
|
||||
|
||||
# Then
|
||||
assert results.total_count == 1
|
||||
assert len(results) == 1
|
||||
|
||||
entry = entries[0]
|
||||
assert (entry.path.suffix == ".txt") == is_exclude
|
||||
|
||||
|
||||
def test_search_library_case_insensitive(library: Library):
|
||||
# Given
|
||||
entries = list(library.all_entries(with_joins=True))
|
||||
|
||||
@@ -23,11 +23,11 @@ def verify_count(lib: Library, query: str, count: int):
|
||||
@pytest.mark.parametrize(
|
||||
["query", "count"],
|
||||
[
|
||||
("", 31),
|
||||
("path:*", 31),
|
||||
("", 32),
|
||||
("path:*", 32),
|
||||
("path:*inherit*", 24),
|
||||
("path:*comp*", 5),
|
||||
("special:untagged", 2),
|
||||
("special:untagged", 3),
|
||||
("filetype:png", 25),
|
||||
("filetype:jpg", 6),
|
||||
("filetype:'jpg'", 6),
|
||||
@@ -89,22 +89,22 @@ def test_or(search_library: Library, query: str, count: int):
|
||||
@pytest.mark.parametrize(
|
||||
["query", "count"],
|
||||
[
|
||||
("not unexistant", 31),
|
||||
("not unexistant", 32),
|
||||
("not path:*", 0),
|
||||
("not not path:*", 31),
|
||||
("not not path:*", 32),
|
||||
("not special:untagged", 29),
|
||||
("not filetype:png", 6),
|
||||
("not filetype:jpg", 25),
|
||||
("not tag_id:1011", 26),
|
||||
("not tag_id:1038", 20),
|
||||
("not green", 26),
|
||||
("not filetype:png", 7),
|
||||
("not filetype:jpg", 26),
|
||||
("not tag_id:1011", 27),
|
||||
("not tag_id:1038", 21),
|
||||
("not green", 27),
|
||||
("tag:favorite", 0),
|
||||
("not circle", 20),
|
||||
("not tag:square", 20),
|
||||
("not circle", 21),
|
||||
("not tag:square", 21),
|
||||
("circle and not square", 6),
|
||||
("not circle and square", 6),
|
||||
("special:untagged or not filetype:jpg", 25),
|
||||
("not square or green", 22),
|
||||
("special:untagged or not filetype:jpg", 26),
|
||||
("not square or green", 23),
|
||||
],
|
||||
)
|
||||
def test_not(search_library: Library, query: str, count: int):
|
||||
@@ -118,7 +118,7 @@ def test_not(search_library: Library, query: str, count: int):
|
||||
("(((tag_id:1041)))", 11),
|
||||
("not (not tag_id:1041)", 11),
|
||||
("((circle) and (not square))", 6),
|
||||
("(not ((square) OR (green)))", 17),
|
||||
("(not ((square) OR (green)))", 18),
|
||||
("filetype:png and (tag:square or green)", 12),
|
||||
],
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user