Format: text/x-python
⬇ Download File (794 B)
   1  from .._events import (
   2      ConnectionClosed,
   3      Data,
   4      EndOfMessage,
   5      Event,
   6      InformationalResponse,
   7      Request,
   8      Response,
   9  )
  10  from .helpers import normalize_data_events
  11  
  12  
  13  def test_normalize_data_events() -> None:
  14      assert normalize_data_events(
  15          [
  16              Data(data=bytearray(b"1")),
  17              Data(data=b"2"),
  18              Response(status_code=200, headers=[]),  # type: ignore[arg-type]
  19              Data(data=b"3"),
  20              Data(data=b"4"),
  21              EndOfMessage(),
  22              Data(data=b"5"),
  23              Data(data=b"6"),
  24              Data(data=b"7"),
  25          ]
  26      ) == [
  27          Data(data=b"12"),
  28          Response(status_code=200, headers=[]),  # type: ignore[arg-type]
  29          Data(data=b"34"),
  30          EndOfMessage(),
  31          Data(data=b"567"),
  32      ]
  33