Skip to content

Commit

Permalink
Fix bug in StringQuery.string_match
Browse files Browse the repository at this point in the history
  • Loading branch information
rcrowell committed Jan 26, 2022
1 parent 6457532 commit 2cab2d6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion beets/dbcore/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def col_clause(self):

@classmethod
def string_match(cls, pattern, value):
return pattern == value
return pattern.lower() == value.lower()


class SubstringQuery(StringFieldQuery):
Expand Down
4 changes: 2 additions & 2 deletions test/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,12 +395,12 @@ def test_substring_match_non_string_value(self):
def test_exact_match_nocase_positive(self):
q = dbcore.query.StringQuery('genre', 'the genre')
self.assertTrue(q.match(self.item))
q = dbcore.query.StringQuery('genre', 'THE GENRE')
self.assertTrue(q.match(self.item))

def test_exact_match_nocase_negative(self):
q = dbcore.query.StringQuery('genre', 'genre')
self.assertFalse(q.match(self.item))
q = dbcore.query.StringQuery('genre', 'THE GENRE')
self.assertFalse(q.match(self.item))

def test_year_match_positive(self):
q = dbcore.query.NumericQuery('year', '1')
Expand Down

0 comments on commit 2cab2d6

Please sign in to comment.