Skip to content

Commit b1255a9

Browse files
committed
style(mark): type hint **kwargs as str | int | bool | None
1 parent c3e8983 commit b1255a9

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/_pytest/mark/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def from_item(cls, item: Item) -> KeywordMatcher:
184184

185185
return cls(mapped_names)
186186

187-
def __call__(self, subname: str, /, **kwargs: object) -> bool:
187+
def __call__(self, subname: str, /, **kwargs: str | int | bool | None) -> bool:
188188
if kwargs:
189189
raise UsageError("Keyword expressions do not support call parameters.")
190190
subname = subname.lower()
@@ -234,7 +234,7 @@ def from_markers(cls, markers: Iterable[Mark]) -> MarkMatcher:
234234
mark_name_mapping[mark.name].append(mark)
235235
return cls(mark_name_mapping)
236236

237-
def __call__(self, name: str, /, **kwargs: object) -> bool:
237+
def __call__(self, name: str, /, **kwargs: str | int | bool | None) -> bool:
238238
if not (matches := self.own_mark_name_mapping.get(name, [])):
239239
return False
240240

src/_pytest/mark/expression.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ def all_kwargs(s: Scanner) -> list[ast.keyword]:
260260

261261

262262
class MatcherCall(Protocol):
263-
def __call__(self, name: str, /, **kwargs: object) -> bool: ...
263+
def __call__(self, name: str, /, **kwargs: str | int | bool | None) -> bool: ...
264264

265265

266266
@dataclasses.dataclass
@@ -271,7 +271,7 @@ class MatcherNameAdapter:
271271
def __bool__(self) -> bool:
272272
return self.matcher(self.name)
273273

274-
def __call__(self, **kwargs: object) -> bool:
274+
def __call__(self, **kwargs: str | int | bool | None) -> bool:
275275
return self.matcher(self.name, **kwargs)
276276

277277

0 commit comments

Comments
 (0)