code: def test_get_tui_choices_from_scan_with_preselection(self) -> None:
      choices = _get_tui_choices_from_scan(
          repos=_get_cache_mock().repos,
          preselected=[
              "dataset_revision_hash_id",  # dataset_1 is preselected
              "a_revision_id_that_does_not_exist",  # unknown but will not complain
              "older_hash_id",  # only the oldest revision from model_2
          ],
      )
      self.assertEqual(len(choices), 8)
  
      # Item to cancel everything
      self.assertIsInstance(choices[0], Choice)
      self.assertEqual(choices[0].value, _CANCEL_DELETION_STR)
      self.assertTrue(len(choices[0].name) != 0)
      self.assertFalse(choices[0].enabled)
  
      # Dataset repo separator
      self.assertIsInstance(choices[1], Separator)
      self.assertEqual(
          choices[1]._line,
          "\nDataset dummy_dataset (8M, used 2 weeks ago)",
      )
  
      # Only revision of `dummy_dataset`
      self.assertIsInstance(choices[2], Choice)
      self.assertEqual(choices[2].value, "dataset_revision_hash_id")
      self.assertEqual(
          choices[2].name,
          # truncated hash id + detached + last modified
          "dataset_: (detached) # modified 1 day ago",
      )
      self.assertTrue(choices[2].enabled)  # preselected
  
      # Model `dummy_model` separator
      self.assertIsInstance(choices[3], Separator)
      self.assertEqual(
          choices[3]._line,
          "\nModel dummy_model (1.4K, used 2 years ago)",
      )
  
      # Oldest revision of `dummy_model`
      self.assertIsInstance(choices[4], Choice)
      self.assertEqual(choices[4].value, "older_hash_id")
      self.assertEqual(
          choices[4].name, "older_ha: (detached) # modified 3 years ago"
      )
      self.assertTrue(choices[4].enabled)  # preselected
  
      # Newest revision of `dummy_model`
      self.assertIsInstance(choices[5], Choice)
      self.assertEqual(choices[5].value, "recent_hash_id")
      self.assertEqual(
          choices[5].name, "recent_h: main # modified 2 years ago"
      )
      self.assertFalse(choices[5].enabled)
  
      # Model `gpt2` separator
      self.assertIsInstance(choices[6], Separator)
      self.assertEqual(
          choices[6]._line, "\nModel gpt2 (3.6G, used 2 hours ago)"
      )
  
      # Only revision of `gpt2`
      self.assertIsInstance(choices[7], Choice)
      self.assertEqual(choices[7].value, "abcdef123456789")
      self.assertEqual(
          choices[7].name,
          "abcdef12: main, refs/pr/1 # modified 2 years ago",
      )
      self.assertFalse(choices[7].enabled)
  
imports: import os
  import unittest
  from pathlib import Path
  from tempfile import mkstemp
  from unittest.mock import Mock, patch
  from InquirerPy.base.control import Choice
  from InquirerPy.separator import Separator
  from huggingface_hub.commands.delete_cache import _CANCEL_DELETION_STR, DeleteCacheCommand, _ask_for_confirmation_no_tui, _get_expectations_str, _get_tui_choices_from_scan, _manual_review_no_tui, _read_manual_review_tmp_file
  from huggingface_hub.utils import SoftTemporaryDirectory, capture_output
  from .testing_utils import handle_injection
label_desc: Use image node_id 2 for calling the TestDeleteCacheHelpers obj's underlying member method code with example usage: obj.test_get_tui_choices_from_scan_with_preselection() without return types