From 28a750754fb66194b24e7497a7667c486ebea929 Mon Sep 17 00:00:00 2001 From: Andreas Schimmelschulze Date: Tue, 28 Nov 2023 16:32:47 +0100 Subject: [PATCH] refactor: get rid of some type hint related warnings --- http_request_recorder/http_request_recorder.py | 4 ++-- setup.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/http_request_recorder/http_request_recorder.py b/http_request_recorder/http_request_recorder.py index 77b0289..6f7fd25 100644 --- a/http_request_recorder/http_request_recorder.py +++ b/http_request_recorder/http_request_recorder.py @@ -49,7 +49,7 @@ def __init__(self, matcher, responses: ResponsesType, name: str, timeout: int): elif isinstance(responses, Iterable): self.responses = map(ExpectedInteraction.SingleRequest, responses) if hasattr(responses, "__len__"): - self.expected_count = len(responses) + self.expected_count = sum(1 for _ in responses) else: raise TypeError("responses must be str | bytes | web.Response | Iterable[str] | Iterable[bytes] | Iterable[web.Response]") @@ -60,7 +60,7 @@ def __init__(self, matcher, responses: ResponsesType, name: str, timeout: int): def __repr__(self): return f"<{self.__class__.__name__} '{self.name}'>" - def record_once(self, request_body: str): + def record_once(self, request_body: bytes): for_response = next(self._next_for_response) for_response.request = request_body for_response.was_triggered.set() diff --git a/setup.py b/setup.py index d6f6bc2..ea7cd63 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ setup( name='http_request_recorder', - version='0.2.0', + version='0.2.1', description='A package to record an respond to http requests, primarily for use in black box testing.', long_description=readme, author='',