code: def test_multiple_events_with_data() -> None:
      def body() -> Iterator[str]:
          yield "event: ping"
          yield 'data: {"foo":true}'
          yield ""
          yield "event: completion"
          yield 'data: {"bar":false}'
          yield ""
  
      it = SSEDecoder().iter(body())
  
      sse = next(it)
      assert sse.event == "ping"
      assert sse.json() == {"foo": True}
  
      sse = next(it)
      assert sse.event == "completion"
      assert sse.json() == {"bar": False}
  
      with pytest.raises(StopIteration):
          next(it)
  
file_path: openai-python/tests/test_streaming.py
imports: from typing import Iterator, AsyncIterator
  import pytest
  from openai._streaming import SSEDecoder
label_desc: Use image node_id 5 for calling a global function with example usage: test_multiple_events_with_data() without return types