class_docstr: Test CLAVR-X Reader with Polar files.
docstr: Test available_datasets with fake variables from YAML.
docstr_tok: ["Test","available_datasets","with","fake","variables","from","YAML","."]
code: def test_available_datasets(self):
      """Test available_datasets with fake variables from YAML."""
      from satpy.readers import load_reader
  
      r = load_reader(self.reader_configs)
      loadables = r.select_files_from_pathnames(
          [
              "clavrx_npp_d20170520_t2053581_e2055223_b28822.level2.hdf",
          ]
      )
      assert len(loadables) == 1
      r.create_filehandlers(loadables)
      # make sure we have some files
      assert r.file_handlers
  
      # mimic the YAML file being configured for more datasets
      fake_dataset_info = [
          (
              None,
              {
                  "name": "variable1",
                  "resolution": None,
                  "file_type": ["clavrx_hdf4"],
              },
          ),
          (
              True,
              {
                  "name": "variable2",
                  "resolution": 742,
                  "file_type": ["clavrx_hdf4"],
              },
          ),
          (
              True,
              {
                  "name": "variable2",
                  "resolution": 1,
                  "file_type": ["clavrx_hdf4"],
              },
          ),
          (
              None,
              {
                  "name": "variable2",
                  "resolution": 1,
                  "file_type": ["clavrx_hdf4"],
              },
          ),
          (None, {"name": "_fake1", "file_type": ["clavrx_hdf4"]}),
          (None, {"name": "variable1", "file_type": ["level_fake"]}),
          (True, {"name": "variable3", "file_type": ["clavrx_hdf4"]}),
      ]
      new_ds_infos = list(
          r.file_handlers["clavrx_hdf4"][0].available_datasets(
              fake_dataset_info
          )
      )
      assert len(new_ds_infos) == 9
  
      # we have this and can provide the resolution
      assert new_ds_infos[0][0]
      assert new_ds_infos[0][1]["resolution"] == 742  # hardcoded
  
      # we have this, but previous file handler said it knew about it
      # and it is producing the same resolution as what we have
      assert new_ds_infos[1][0]
      assert new_ds_infos[1][1]["resolution"] == 742
  
      # we have this, but don't want to change the resolution
      # because a previous handler said it has it
      assert new_ds_infos[2][0]
      assert new_ds_infos[2][1]["resolution"] == 1
  
      # even though the previous one was known we can still
      # produce it at our new resolution
      assert new_ds_infos[3][0]
      assert new_ds_infos[3][1]["resolution"] == 742
  
      # we have this and can update the resolution since
      # no one else has claimed it
      assert new_ds_infos[4][0]
      assert new_ds_infos[4][1]["resolution"] == 742
  
      # we don't have this variable, don't change it
      assert not new_ds_infos[5][0]
      assert new_ds_infos[5][1].get("resolution") is None
  
      # we have this, but it isn't supposed to come from our file type
      assert new_ds_infos[6][0] is None
      assert new_ds_infos[6][1].get("resolution") is None
  
      # we could have loaded this but some other file handler said it has this
      assert new_ds_infos[7][0]
      assert new_ds_infos[7][1].get("resolution") is None
  
      # we can add resolution to the previous dataset, so we do
      assert new_ds_infos[8][0]
      assert new_ds_infos[8][1]["resolution"] == 742
  
imports: import os
  import unittest
  from unittest import mock
  import dask.array
  import numpy
  import pytest
  import xarray
  from pyresample.geometry import AreaDefinition, SwathDefinition
  from satpy.tests.reader_tests.test_hdf4_utils import FakeHDF4FileHandler
label_desc: Use image node_id 4 for calling the TestCLAVRXReaderPolar obj's underlying member method code with example usage: obj.test_available_datasets() without return types