class_docstr: Test VIIRS SDR downloading.
class_docstr_tok: ["Test","VIIRS","SDR","downloading","."]
docstr: Test re-downloading VIIRS SDR I/M data with select granules.
docstr_tok: ["Test","re-downloading","VIIRS","SDR","I\/M","data","with","select","granules","."]
code: def test_download_channels_num_granules_im_twice(
      self, requests, tmpdir
  ):
      """Test re-downloading VIIRS SDR I/M data with select granules."""
      from satpy.demo import get_viirs_sdr_20170128_1229
  
      get_mock = mock.MagicMock()
      requests.get.return_value.__enter__ = get_mock
      with mock_filesystem():
          files = get_viirs_sdr_20170128_1229(
              base_dir=str(tmpdir), channels=("I01", "M01")
          )
          num_first_batch = 10 * (
              1 + 1 + 2
          )  # 10 granules * (1 I band + 1 M band + 2 geolocation)
          assert len(files) == num_first_batch
  
          files = get_viirs_sdr_20170128_1229(
              base_dir=str(tmpdir),
              channels=("I01", "M01"),
              granules=(2, 3),
          )
          assert len(files) == 2 * (
              1 + 1 + 2
          )  # 2 granules * (1 I band + 1 M band + 2 geolocation)
          assert get_mock.call_count == num_first_batch
  
imports: from __future__ import annotations
  import contextlib
  import io
  import os
  import sys
  import tarfile
  import unittest
  from collections import defaultdict
  from unittest import mock
  import pytest
label_desc: Use image node_id 4 for calling the TestVIIRSSDRDemoDownload obj's underlying member method code with example usage: obj.test_download_channels_num_granules_im_twice(requests, tmpdir) without return types