From b1255a9aae1bd94d8c226b207c38942c857d4794 Mon Sep 17 00:00:00 2001 From: lovetheguitar Date: Fri, 21 Jun 2024 17:11:39 +0200 Subject: [PATCH] style(mark): type hint `**kwargs` as `str | int | bool | None` --- src/_pytest/mark/__init__.py | 4 ++-- src/_pytest/mark/expression.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/_pytest/mark/__init__.py b/src/_pytest/mark/__init__.py index dccc6c529..702732c97 100644 --- a/src/_pytest/mark/__init__.py +++ b/src/_pytest/mark/__init__.py @@ -184,7 +184,7 @@ class KeywordMatcher: return cls(mapped_names) - def __call__(self, subname: str, /, **kwargs: object) -> bool: + def __call__(self, subname: str, /, **kwargs: str | int | bool | None) -> bool: if kwargs: raise UsageError("Keyword expressions do not support call parameters.") subname = subname.lower() @@ -234,7 +234,7 @@ class MarkMatcher: mark_name_mapping[mark.name].append(mark) return cls(mark_name_mapping) - def __call__(self, name: str, /, **kwargs: object) -> bool: + def __call__(self, name: str, /, **kwargs: str | int | bool | None) -> bool: if not (matches := self.own_mark_name_mapping.get(name, [])): return False diff --git a/src/_pytest/mark/expression.py b/src/_pytest/mark/expression.py index c1770c197..3f4071dce 100644 --- a/src/_pytest/mark/expression.py +++ b/src/_pytest/mark/expression.py @@ -260,7 +260,7 @@ def all_kwargs(s: Scanner) -> list[ast.keyword]: class MatcherCall(Protocol): - def __call__(self, name: str, /, **kwargs: object) -> bool: ... + def __call__(self, name: str, /, **kwargs: str | int | bool | None) -> bool: ... @dataclasses.dataclass @@ -271,7 +271,7 @@ class MatcherNameAdapter: def __bool__(self) -> bool: return self.matcher(self.name) - def __call__(self, **kwargs: object) -> bool: + def __call__(self, **kwargs: str | int | bool | None) -> bool: return self.matcher(self.name, **kwargs)