code: def test_check_existing(
      api, tmpdir, smallest_online_products, smallest_archived_products
  ):
      ids = [product["id"] for product in smallest_online_products]
      names = [product["title"] for product in smallest_online_products]
      paths = [tmpdir.join(fn + ".zip") for fn in names]
      path_strings = list(map(str, paths))
  
      # Init files used for testing
      api.download(ids[0], str(tmpdir))
      # File #1: complete and correct
      assert paths[0].check(exists=1, file=1)
      # File #2: complete but incorrect
      with paths[1].open("wb") as f:
          size = 130102
          f.seek(size - 1)
          f.write(b"\0")
      # File #3: incomplete
      dummy_content = b"aaaaaaaaaaaaaaaaaaaaaaaaa"
      with paths[2].open("wb") as f:
          f.write(dummy_content)
      assert paths[2].check(exists=1, file=1)
  
      # Test
      expected = {str(paths[1]), str(paths[2])}
  
      def check_result(result, expected_existing):
          assert set(result) == expected
          assert result[str(paths[1])][0]["id"] == ids[1]
          assert result[str(paths[2])][0]["id"] == ids[2]
          assert [
              p.check(exists=1, file=1) for p in paths
          ] == expected_existing
  
      result = api.check_files(ids=ids, directory=str(tmpdir))
      check_result(result, [True, True, True])
  
      result = api.check_files(paths=path_strings)
      check_result(result, [True, True, True])
  
      result = api.check_files(paths=path_strings, delete=True)
      check_result(result, [True, False, False])
  
      missing_file = str(
          tmpdir.join(smallest_archived_products[0]["title"] + ".zip")
      )
      result = api.check_files(paths=[missing_file])
      assert set(result) == {missing_file}
      assert (
          result[missing_file][0]["id"]
          == smallest_archived_products[0]["id"]
      )
  
      with pytest.raises(ValueError):
          api.check_files(ids=ids)
  
      with pytest.raises(ValueError):
          api.check_files()
  
      tmpdir.remove()
  
file_path: sentinelsat/tests/test_misc.py
imports: import hashlib
  import pytest
  import requests
  import requests_mock
  from sentinelsat import SentinelAPI
  from sentinelsat.exceptions import SentinelAPIError, QuerySyntaxError, InvalidKeyError
  from sentinelsat.sentinel import _parse_opensearch_response
label_desc: Use image node_id 7 for calling a global function with example usage: test_check_existing(api, tmpdir, smallest_online_products, smallest_archived_products) without return types