docstr: Scan the cache dir without warnings (on unix-based platform).
  
  This test is duplicated and adapted for Windows in `test_scan_cache_on_valid_cache_windows`.
  Note: Please make sure to updated both if any change is made.
docstr_tok: ["Scan","the","cache","dir","without","warnings","(","on","unix-based","platform",")",".","This","test","is","duplicated","and","adapted","for","Windows","in","`","test_scan_cache_on_valid_cache_windows","`",".","Note",":","Please","make","sure","to","updated","both","if","any","change","is","made","."]
code: def test_scan_cache_on_valid_cache_unix(self) -> None:
      """Scan the cache dir without warnings (on unix-based platform).
  
      This test is duplicated and adapted for Windows in `test_scan_cache_on_valid_cache_windows`.
      Note: Please make sure to updated both if any change is made.
      """
      report = scan_cache_dir(self.cache_dir)
  
      # Check general information about downloaded snapshots
      self.assertEqual(report.size_on_disk, 3766)
      self.assertEqual(len(report.repos), 2)  # Model and dataset
      self.assertEqual(len(report.warnings), 0)  # Repos are valid
  
      repo_a = [
          repo for repo in report.repos if repo.repo_id == MODEL_ID
      ][0]
  
      # Check repo A general information
      repo_a_path = self.cache_dir / MODEL_PATH
      self.assertEqual(repo_a.repo_id, MODEL_ID)
      self.assertEqual(repo_a.repo_type, "model")
      self.assertEqual(repo_a.repo_path, repo_a_path)
  
      # 4 downloads but 3 revisions because "main" and REPO_A_MAIN_HASH are the same
      self.assertEqual(len(repo_a.revisions), 3)
      self.assertEqual(
          {rev.commit_hash for rev in repo_a.revisions},
          {REPO_A_MAIN_HASH, REPO_A_PR_1_HASH, REPO_A_OTHER_HASH},
      )
  
      # Repo size on disk is less than sum of revisions !
      self.assertEqual(repo_a.size_on_disk, 1501)
      self.assertEqual(
          sum(rev.size_on_disk for rev in repo_a.revisions), 4463
      )
  
      # Repo nb files is less than sum of revisions !
      self.assertEqual(repo_a.nb_files, 3)
      self.assertEqual(sum(rev.nb_files for rev in repo_a.revisions), 6)
  
      # 2 REFS in the repo: "main" and "refs/pr/1"
      # We could have add a tag as well
      self.assertEqual(set(repo_a.refs.keys()), {"main", REF_1_NAME})
      self.assertEqual(
          repo_a.refs["main"].commit_hash, REPO_A_MAIN_HASH
      )
      self.assertEqual(
          repo_a.refs[REF_1_NAME].commit_hash, REPO_A_PR_1_HASH
      )
  
      # Check "main" revision information
      main_revision = repo_a.refs["main"]
      main_revision_path = repo_a_path / "snapshots" / REPO_A_MAIN_HASH
  
      self.assertEqual(main_revision.commit_hash, REPO_A_MAIN_HASH)
      self.assertEqual(main_revision.snapshot_path, main_revision_path)
      self.assertEqual(main_revision.refs, {"main"})
  
      # Same nb of files and size on disk that the sum
      self.assertEqual(main_revision.nb_files, len(main_revision.files))
      self.assertEqual(
          main_revision.size_on_disk,
          sum(file.size_on_disk for file in main_revision.files),
      )
  
      # Check readme file from "main" revision
      main_readme_file = [
          file
          for file in main_revision.files
          if file.file_name == "README.md"
      ][0]
      main_readme_file_path = main_revision_path / "README.md"
      main_readme_blob_path = (
          repo_a_path / "blobs" / REPO_A_MAIN_README_BLOB_HASH
      )
  
      self.assertEqual(main_readme_file.file_name, "README.md")
      self.assertEqual(
          main_readme_file.file_path, main_readme_file_path
      )
      self.assertEqual(
          main_readme_file.blob_path, main_readme_blob_path
      )
  
      # Check readme file from "refs/pr/1" revision
      pr_1_revision = repo_a.refs[REF_1_NAME]
      pr_1_revision_path = repo_a_path / "snapshots" / REPO_A_PR_1_HASH
      pr_1_readme_file = [
          file
          for file in pr_1_revision.files
          if file.file_name == "README.md"
      ][0]
      pr_1_readme_file_path = pr_1_revision_path / "README.md"
  
      # file_path in "refs/pr/1" revision is different than "main" but same blob path
      self.assertEqual(
          pr_1_readme_file.file_path, pr_1_readme_file_path
      )  # different
      self.assertEqual(
          pr_1_readme_file.blob_path, main_readme_blob_path
      )
  
imports: import os
  import tempfile
  import time
  import unittest
  from pathlib import Path
  from unittest.mock import Mock
  import pytest
  from huggingface_hub._snapshot_download import snapshot_download
  from huggingface_hub.commands.scan_cache import ScanCacheCommand
  from huggingface_hub.utils import DeleteCacheStrategy, HFCacheInfo, capture_output, scan_cache_dir
  from huggingface_hub.utils._cache_manager import CacheNotFound, _format_size, _format_timesince, _try_delete_path
  from .testing_constants import TOKEN
  from .testing_utils import rmtree_with_retry, with_production_testing, xfail_on_windows
label_desc: Use image node_id 2 for calling the TestValidCacheUtils obj's underlying member method code with example usage: obj.test_scan_cache_on_valid_cache_unix() without return types