with pytest.raises(Exception):
@requires("authenticated")
- def foo() -> None:
- pass # pragma: no cover
+ def foo() -> None: # pragma: no cover
+ pass
def test_user_interface(test_client_factory: TestClientFactory) -> None:
def increment() -> None:
nonlocal TASK_COUNTER
TASK_COUNTER += 1
- if TASK_COUNTER == 1:
+ if TASK_COUNTER == 1: # pragma: no branch
raise Exception("task failed")
async def app(scope: Scope, receive: Receive, send: Send) -> None:
assert "content-disposition" in headers
assert "last-modified" in headers
assert "etag" in headers
- elif message["type"] == "http.response.body":
+ elif message["type"] == "http.response.body": # pragma: no branch
assert message["body"] == b""
assert message["more_body"] is False
async def send(message: Message) -> None:
if message["type"] == "http.response.start":
start_message.update(message)
- elif message["type"] == "http.response.body":
+ elif message["type"] == "http.response.body": # pragma: no branch
received_chunks.append(message["body"])
await app({"type": "http", "method": "get", "headers": [(b"range", b"bytes=0-15,20-35,35-50")]}, receive, send)
async def app(scope: Scope, receive: Receive, send: Send) -> None:
async def _send(message: Message) -> None:
nonlocal startup_failed
- if message["type"] == "lifespan.startup.failed":
+ if message["type"] == "lifespan.startup.failed": # pragma: no branch
startup_failed = True
return await send(message)