From 6c8bd424e8cc308351a9c145107d116ffa146dd9 Mon Sep 17 00:00:00 2001 From: Karl Besser Date: Sun, 22 Sep 2024 18:30:28 -0400 Subject: [PATCH] Add unit tests to test new feat. X detection regex The previous version of the `plugins.feat_tokens` regular expression only matched "feat. X" parts if preceded by a space. This caused missed detections in the `ftintitle.contains_feat` function. This commit adds unit tests for the updated regex that also matches "feat. X" parts within parentheses and brackets --- test/plugins/test_ftintitle.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/plugins/test_ftintitle.py b/test/plugins/test_ftintitle.py index 45146b42b7..9e8f14fe1a 100644 --- a/test/plugins/test_ftintitle.py +++ b/test/plugins/test_ftintitle.py @@ -183,5 +183,10 @@ def test_contains_feat(self): assert ftintitle.contains_feat("Alice & Bob") assert ftintitle.contains_feat("Alice and Bob") assert ftintitle.contains_feat("Alice With Bob") + assert ftintitle.contains_feat("Alice (ft. Bob)") + assert ftintitle.contains_feat("Alice (feat. Bob)") + assert ftintitle.contains_feat("Alice [ft. Bob]") + assert ftintitle.contains_feat("Alice [feat. Bob]") assert not ftintitle.contains_feat("Alice defeat Bob") assert not ftintitle.contains_feat("Aliceft.Bob") + assert not ftintitle.contains_feat("Alice (defeat Bob)")