Skip to content

Commit

Permalink
fix: typing annotations
Browse files Browse the repository at this point in the history
With the `Matcher` accepting a generic typevar, there were a few
instances where the typevar was missing.

Signed-off-by: JP-Ellis <josh@jpellis.me>
  • Loading branch information
JP-Ellis committed Oct 9, 2024
1 parent 7c51588 commit caf5efd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/pact/v3/interaction/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from pathlib import Path

from pact.v3.match import Matcher
from pact.v3.types import Matchable

try:
from typing import Self
Expand Down Expand Up @@ -248,7 +249,7 @@ def given(

def with_body(
self,
body: str | dict | Matcher | None = None,
body: str | dict[str, Any] | Matcher[Matchable] | None = None,
content_type: str | None = None,
part: Literal["Request", "Response"] | None = None,
) -> Self:
Expand Down
10 changes: 7 additions & 3 deletions src/pact/v3/interaction/_http_interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def _interaction_part(self) -> pact.v3.ffi.InteractionPart:
"""
return self.__interaction_part

def with_request(self, method: str, path: str | Matcher) -> Self:
def with_request(self, method: str, path: str | Matcher[Any]) -> Self:
"""
Set the request.
Expand All @@ -119,7 +119,7 @@ def with_request(self, method: str, path: str | Matcher) -> Self:
def with_header(
self,
name: str,
value: str | dict | Matcher,
value: str | dict[str, str] | Matcher[Any],
part: Literal["Request", "Response"] | None = None,
) -> Self:
r"""
Expand Down Expand Up @@ -353,7 +353,11 @@ def set_headers(
self.set_header(name, value, part)
return self

def with_query_parameter(self, name: str, value: str | dict | Matcher) -> Self:
def with_query_parameter(
self,
name: str,
value: str | dict[str, str] | Matcher[Any],
) -> Self:
r"""
Add a query to the request.
Expand Down

0 comments on commit caf5efd

Please sign in to comment.