code: def test_sha1_add_state_dict(sha1_store, compress):
      os.chdir(TESTING_STORE_DIR)
      # add once
      for i in range(3):
          sha1_store.add(nn.Linear(100, 100).state_dict(), compress)
      # add twice
      for i in range(3):
          sd = nn.Linear(80, 80).state_dict()
          sha1_store.add(sd, compress)
          sha1_store.add(sd, compress)
  
      with sha1_store._readonly_json_ctx:
          json_dict = sha1_store._json_dict
      json_dict = dict(
          filter(
              lambda item: len(item[0]) == SHA1_KEY_STR_LEN,
              json_dict.items(),
          )
      )
      assert sorted(
          map(lambda x: x["ref_count"], json_dict.values())
      ) == [1, 1, 1, 2, 2, 2], json_dict
  
file_path: fairscale/tests/experimental/wgit/test_sha1_store.py
imports: import os
  from pathlib import Path
  import shutil
  import sys
  import pytest
  import torch
  from torch import nn
  from fairscale.experimental.wgit.sha1_store import SHA1_Store
  from fairscale.fair_dev.testing.testing import objects_are_equal
label_desc: Use image node_id 3 for calling a global function with example usage: test_sha1_add_state_dict(sha1_store, compress) without return types