beets/test
Arne Beer 4d7b9cb14b fix(lastgenre): Canonicalize keep_existing fallback
Fixes a bug where existing tags were set to None, if they weren't whitelisted, but an whitelisted canonicalized parent existed up the tree.

In all other cases, the original genres are canonicalized and considered for the final genre, except in the keep_existing logic branch.
This PR fixes the issue and results in the expected behavior for this combination of options.

For the bug to trigger several conditions had to be met:

- Canonicalization is enabled and a whitelist is specified.
- `force` and `keep_existing` are set. Meaning, that Lastfm is queried for a genre, but the existing genres are still left around when none are found online.
- A release with a non-whitelisted genre exists, but that genre has a whitelisted genre parent up the tree.
- That very release has no genre on lastfm.

This is rather convoluted, but stay with me :D
What would happen is the following:

- `keep_genres` is set to the existing genres, as `force` and `keep_existing` is set.
- Genres for `track`/`album`/`artist` aren't found for this release, as they don't exist in lastfm.
- Then the `keep_existing` logic is entered.
  - The old logic only checks if the existing genres have an **exact** match for the whitelist. In contrast to all other code branches, we don't do the `_try_resolve_stage` in case there's no direct match, resulting in no match.
- We continue to the fallback logic, which returns the fallback (`None` in my case)

This patch results in one last try to resolve the existing genres when `keep_existing` is set, which includes canonicalization (if enabled).
2026-01-31 13:22:56 +01:00
..
autotag Enable RUF rules 2026-01-13 20:55:40 +00:00
plugins fix(lastgenre): Canonicalize keep_existing fallback 2026-01-31 13:22:56 +01:00
rsrc musicbrainz: lookup release directly 2025-12-20 01:35:51 +00:00
ui Enable RUF rules 2026-01-13 20:55:40 +00:00
util Enable RUF rules 2026-01-13 20:55:40 +00:00
__init__.py Remove unused imports 2021-08-26 20:59:48 +10:00
conftest.py Define a shared fixture for config 2025-12-27 14:30:35 +00:00
test_art_resize.py Enable RUF rules 2026-01-13 20:55:40 +00:00
test_autotag.py Define a shared fixture for config 2025-12-27 14:30:35 +00:00
test_datequery.py Replace string concatenation (' + ') 2025-08-30 23:10:15 +01:00
test_dbcore.py Merge branch 'master' into indices 2026-01-30 01:03:18 +00:00
test_files.py reflink() doesn't take Path parameters 2025-11-23 13:50:57 -04:00
test_hidden.py Fix duplicate database change event send on Library.add (#5561) 2025-05-30 13:41:29 +00:00
test_importer.py Merge branch 'master' into master 2025-07-23 19:44:17 +02:00
test_library.py Enable RUF rules 2026-01-13 20:55:40 +00:00
test_logging.py fix: Sanitize log messages by removing control characters 2025-12-02 15:27:24 +05:00
test_m3ufile.py Reformat the codebase 2024-09-21 11:57:48 +01:00
test_metasync.py Reformat the codebase 2024-09-21 11:57:48 +01:00
test_pipeline.py pipeline: remove old tests, integrate with out test suite 2025-05-06 14:51:20 +02:00
test_plugins.py Address RUF012 2026-01-13 20:55:40 +00:00
test_query.py Refactor test_query 2025-07-06 16:15:30 +01:00
test_release.py Update release conversion logic accordingly 2025-08-10 16:25:05 +01:00
test_sort.py pyupgrade Python 3.10 2025-11-08 12:09:52 +00:00
test_template.py Fix formatting 2025-05-07 10:41:01 +01:00
test_types.py Add NullPathType and types to PathType 2025-07-06 16:09:49 +01:00
test_util.py Simplify and speed up plurality/album tags retrieval tests 2025-05-31 19:17:42 +01:00
testall.py Remove def suite TestLoader definitions 2024-07-28 18:58:51 +01:00