code: def test_api_add(capsys, repo, per_tensor, gzip):
      fnum = random.randint(0, 2)
      chkpt0 = f"checkpoint_{fnum}.pt"
      repo.add(chkpt0, per_tensor=per_tensor, gzip=gzip)
      if per_tensor:
          # TODO (Min): test per_tensor add more.
          return
      sha1_hash = repo._sha1_store._get_sha1_hash(chkpt0)
      metadata_path = repo._rel_file_path(Path(chkpt0))
  
      with open(os.path.join(".wgit", metadata_path), "r") as f:
          json_data = json.load(f)
  
      sha1_dir_0 = f"{sha1_hash[:2]}/" + f"{sha1_hash[2:]}"
      # The sha1 are different because add internally use a different pickle method.
      assert json_data["SHA1"] != sha1_hash
  
file_path: fairscale/tests/experimental/wgit/test_api.py
imports: import json
  import os
  from pathlib import Path
  import random
  import shutil
  import pytest
  import torch
  from torch import nn
  from fairscale.experimental.wgit.repo import Repo, RepoStatus
label_desc: Use image node_id 5 for calling a global function with example usage: test_api_add(capsys, repo, per_tensor, gzip) without return types