class_docstr: Test the interactions between DataIDs and DataQuerys.
class_docstr_tok: ["Test","the","interactions","between","DataIDs","and","DataQuerys","."]
docstr: Check dataid sorting.
docstr_tok: ["Check","dataid","sorting","."]
code: def test_sort_dataids(self):
      """Check dataid sorting."""
      dq = DataQuery(name="cheese_shops", wavelength=2, modifiers="*")
      did = DataID(
          self.default_id_keys_config,
          name="cheese_shops",
          wavelength=(1, 2, 3),
      )
      did2 = DataID(
          self.default_id_keys_config,
          name="cheese_shops",
          wavelength=(1.1, 2.1, 3.1),
      )
      dsids, distances = dq.sort_dataids([did2, did])
      assert list(dsids) == [did, did2]
      assert np.allclose(distances, [0, 0.1])
  
      dq = DataQuery(name="cheese_shops")
      did = DataID(
          self.default_id_keys_config,
          name="cheese_shops",
          resolution=200,
      )
      did2 = DataID(
          self.default_id_keys_config,
          name="cheese_shops",
          resolution=400,
      )
      dsids, distances = dq.sort_dataids([did2, did])
      assert list(dsids) == [did, did2]
      assert distances[0] < distances[1]
  
      did = DataID(
          self.default_id_keys_config,
          name="cheese_shops",
          calibration="counts",
      )
      did2 = DataID(
          self.default_id_keys_config,
          name="cheese_shops",
          calibration="reflectance",
      )
      dsids, distances = dq.sort_dataids([did2, did])
      assert list(dsids) == [did2, did]
      assert distances[0] < distances[1]
  
      did = DataID(
          self.default_id_keys_config,
          name="cheese_shops",
          modifiers=tuple(),
      )
      did2 = DataID(
          self.default_id_keys_config,
          name="cheese_shops",
          modifiers=tuple(["out_of_stock"]),
      )
      dsids, distances = dq.sort_dataids([did2, did])
      assert list(dsids) == [did, did2]
      assert distances[0] < distances[1]
  
imports: import unittest
  from datetime import datetime
  import numpy
  import pytest
  from satpy.dataset.dataid import DataID, DataQuery, ModifierTuple, WavelengthRange, minimal_default_keys_config
  from satpy.readers.pmw_channels_definitions import FrequencyDoubleSideBand, FrequencyQuadrupleSideBand, FrequencyRange
  from satpy.tests.utils import make_cid, make_dataid, make_dsq
label_desc: Use image node_id 5 for calling the TestIDQueryInteractions obj's underlying member method code with example usage: obj.test_sort_dataids() without return types