diff --git a/playwright/_impl/_fetch.py b/playwright/_impl/_fetch.py index 2694ee5e0..3005096eb 100644 --- a/playwright/_impl/_fetch.py +++ b/playwright/_impl/_fetch.py @@ -391,11 +391,14 @@ async def _inner_fetch( ) -> "APIResponse": if self._close_reason: raise TargetClosedError(self._close_reason) - assert ( + if ( (1 if data is not None else 0) + (1 if form is not None else 0) + (1 if multipart is not None else 0) - ) <= 1, "Only one of 'data', 'form' or 'multipart' can be specified" + ) > 1: + raise AssertionError( + "Only one of 'data', 'form' or 'multipart' can be specified" + ) assert ( maxRedirects is None or maxRedirects >= 0 ), "'max_redirects' must be greater than or equal to '0'"