Skip to content

Commit

Permalink
Add unit tests to test new feat. X detection regex
Browse files Browse the repository at this point in the history
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
  • Loading branch information
klb2 committed Sep 22, 2024
1 parent 8c60d2b commit 6c8bd42
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/plugins/test_ftintitle.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)")

0 comments on commit 6c8bd42

Please sign in to comment.