code: def test_clear_dollar(client):
      client.json().set(
          "doc1",
          "$",
          {
              "nested1": {"a": {"foo": 10, "bar": 20}},
              "a": ["foo"],
              "nested2": {"a": "claro"},
              "nested3": {"a": {"baz": 50}},
          },
      )
      # Test multi
      assert client.json().clear("doc1", "$..a") == 3
  
      res = [
          {
              "nested1": {"a": {}},
              "a": [],
              "nested2": {"a": "claro"},
              "nested3": {"a": {}},
          }
      ]
      assert_resp_response(
          client, client.json().get("doc1", "$"), res, [res]
      )
  
      # Test single
      client.json().set(
          "doc1",
          "$",
          {
              "nested1": {"a": {"foo": 10, "bar": 20}},
              "a": ["foo"],
              "nested2": {"a": "claro"},
              "nested3": {"a": {"baz": 50}},
          },
      )
      assert client.json().clear("doc1", "$.nested1.a") == 1
      res = [
          {
              "nested1": {"a": {}},
              "a": ["foo"],
              "nested2": {"a": "claro"},
              "nested3": {"a": {"baz": 50}},
          }
      ]
      assert_resp_response(
          client, client.json().get("doc1", "$"), res, [res]
      )
  
      # Test missing path (defaults to root)
      assert client.json().clear("doc1") == 1
      assert_resp_response(
          client, client.json().get("doc1", "$"), [{}], [[{}]]
      )
  
      # Test missing key
      with pytest.raises(exceptions.ResponseError):
          client.json().clear("non_existing_doc", "$..a")
  
imports: import pytest
  import redis
  from redis import Redis, exceptions
  from redis.commands.json.decoders import decode_list, unstring
  from redis.commands.json.path import Path
  from .conftest import _get_client, assert_resp_response, skip_ifmodversion_lt
label_desc: Use image node_id 43 for calling a global function with example usage: test_clear_dollar(client) without return types