code: def test_client_kwargs():
      register_filesystem("s3", TestS3FileSystem)
  
      test_kwargs = {
          "endpoint_url": "http://192.168.1.12:9000",
          "aws_access_key_id": "test_id",
          "aws_secret_access_key": "test_key",
          "aws_session_token": "test_session_token",
      }
  
      def _assert_true():
          # Pass endpoint_url / aws_access_key_id / aws_secret_access_key / aws_session_token to read_csv.
          with pytest.raises(KwArgsException) as e:
              read_csv(
                  "s3://bucket/example.csv",
                  index_col=0,
                  storage_options={"client_kwargs": test_kwargs},
              )
          assert e.value.kwargs == {
              "client_kwargs": {
                  "endpoint_url": "http://192.168.1.12:9000",
                  "aws_access_key_id": "test_id",
                  "aws_secret_access_key": "test_key",
                  "aws_session_token": "test_session_token",
              }
          }
  
      _assert_true()
  
      test_env = {
          "AWS_ENDPOINT_URL": "a",
          "AWS_ACCESS_KEY_ID": "b",
          "AWS_SECRET_ACCESS_KEY": "c",
          "AWS_SESSION_TOKEN": "d",
      }
      for k, v in test_env.items():
          os.environ[k] = v
  
      try:
          _assert_true()
  
          for k, v in test_kwargs.items():
              with pytest.raises(KwArgsException) as e:
                  read_csv(
                      "s3://bucket/example.csv",
                      index_col=0,
                      storage_options={"client_kwargs": {k: v}},
                  )
              expect = {
                  "endpoint_url": "a",
                  "aws_access_key_id": "b",
                  "aws_secret_access_key": "c",
                  "aws_session_token": "d",
              }
              expect[k] = v
              assert e.value.kwargs == {"client_kwargs": expect}
      finally:
          for k, v in test_env.items():
              os.environ.pop(k, None)
  
file_path: mars/mars/lib/filesystem/tests/test_s3.py
imports: import os
  import pytest
  from ....dataframe import read_csv
  from ..core import register_filesystem
  from ..s3 import S3FileSystem
label_desc: Use image node_id 1 for calling a global function with example usage: test_client_kwargs() without return types