docstr: Useful for constructing Request objects for tests
docstr_tok: ["Useful","for","constructing","Request","objects","for","tests"]
code: def fake(
      cls,
      path_with_query_string,
      method="GET",
      scheme="http",
      url_vars=None,
  ):
      """Useful for constructing Request objects for tests"""
      path, _, query_string = path_with_query_string.partition("?")
      scope = {
          "http_version": "1.1",
          "method": method,
          "path": path,
          "raw_path": path_with_query_string.encode("latin-1"),
          "query_string": query_string.encode("latin-1"),
          "scheme": scheme,
          "type": "http",
      }
      if url_vars:
          scope["url_route"] = {"kwargs": url_vars}
      return cls(scope, None)
  
imports: import json
  from datasette.utils import MultiParams
  from mimetypes import guess_type
  from urllib.parse import parse_qs, urlunparse, parse_qsl
  from pathlib import Path
  from http.cookies import SimpleCookie, Morsel
  import aiofiles
  import aiofiles.os
label_desc: Use image node_id 15 for calling the Request obj's underlying member method code with example usage: obj.fake(cls, path_with_query_string, method, scheme, url_vars) and returns: cls