Skip to content

Commit 443ed57

Browse files
committed
Standardize abstract methods for coverage
1 parent 09b2294 commit 443ed57

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

beets/dbcore/query.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ def field_names(self) -> set[str]:
8585
"""Return a set with field names that this query operates on."""
8686
return set()
8787

88+
@abstractmethod
8889
def clause(self) -> tuple[str | None, Sequence[Any]]:
8990
"""Generate an SQLite expression implementing the query.
9091
@@ -95,14 +96,12 @@ def clause(self) -> tuple[str | None, Sequence[Any]]:
9596
The default implementation returns None, falling back to a slow query
9697
using `match()`.
9798
"""
98-
return None, ()
9999

100100
@abstractmethod
101101
def match(self, obj: Model):
102102
"""Check whether this query matches a given Model. Can be used to
103103
perform queries on arbitrary sets of Model.
104104
"""
105-
...
106105

107106
def __and__(self, other: Query) -> AndQuery:
108107
return AndQuery([self, other])
@@ -152,7 +151,7 @@ def __init__(self, field_name: str, pattern: P, fast: bool = True):
152151
self.fast = fast
153152

154153
def col_clause(self) -> tuple[str, Sequence[SQLiteType]]:
155-
return self.field, ()
154+
raise NotImplementedError
156155

157156
def clause(self) -> tuple[str | None, Sequence[SQLiteType]]:
158157
if self.fast:
@@ -164,7 +163,7 @@ def clause(self) -> tuple[str | None, Sequence[SQLiteType]]:
164163
@classmethod
165164
def value_match(cls, pattern: P, value: Any):
166165
"""Determine whether the value matches the pattern."""
167-
raise NotImplementedError()
166+
raise NotImplementedError
168167

169168
def match(self, obj: Model) -> bool:
170169
return self.value_match(self.pattern, obj.get(self.field_name))
@@ -234,7 +233,7 @@ def string_match(
234233
"""Determine whether the value matches the pattern. Both
235234
arguments are strings. Subclasses implement this method.
236235
"""
237-
raise NotImplementedError()
236+
raise NotImplementedError
238237

239238

240239
class StringQuery(StringFieldQuery[str]):

0 commit comments

Comments
 (0)