# assert_valid_event_stream

> **Function** in `langchain_tests`

📖 [View in docs](https://reference.langchain.com/python/langchain-tests/utils/stream_lifecycle/assert_valid_event_stream)

Assert that a stream of protocol events obeys the lifecycle contract.

## Signature

```python
assert_valid_event_stream(
    events: Iterable[Any],
) -> None
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `events` | `Iterable[Any]` | Yes | Iterable of protocol event dicts (as yielded by `stream_events(version="v3")` or `chunks_to_events`). |

---

[View source on GitHub](https://github.com/langchain-ai/langchain/blob/d2931d878fd39f9dcfef78911056ecef3271ee71/libs/standard-tests/langchain_tests/utils/stream_lifecycle.py#L36)