code: def test_websocket_no_credentials(app: FastAPI):
      client = TestClient(app)
      with pytest.raises(WebSocketDisconnect):
          with client.websocket_connect("/items/foo/ws"):
              pytest.fail(
                  "did not raise WebSocketDisconnect on __enter__"
              )
  
file_path: fastapi/tests/test_tutorial/test_websockets/test_tutorial002_py310.py
imports: import pytest
  from fastapi import FastAPI
  from fastapi.testclient import TestClient
  from fastapi.websockets import WebSocketDisconnect
  from ...utils import needs_py310
label_desc: Use image node_id 6 for calling a global function with example usage: test_websocket_no_credentials(app) without return types