code: def test_sorted_local_importance_counterfactual_explanations(self):
      unsorted_local_importance = [
          {
              "age": 0.985,
              "workclass": 0.65,
              "education": 0.915,
              "occupation": 0.95,
              "hours_per_week": 0.985,
              "gender": 0.67,
              "marital_status": 0.655,
              "race": 0.41,
          },
          {
              "age": 0.985,
              "workclass": 0.65,
              "education": 0.915,
              "occupation": 0.95,
              "hours_per_week": 0.985,
              "gender": 0.67,
              "marital_status": 0.655,
              "race": 0.41,
          },
      ]
  
      sorted_local_importance = [
          {
              "age": 0.985,
              "hours_per_week": 0.985,
              "occupation": 0.95,
              "education": 0.915,
              "gender": 0.67,
              "marital_status": 0.655,
              "workclass": 0.65,
              "race": 0.41,
          },
          {
              "age": 0.985,
              "hours_per_week": 0.985,
              "occupation": 0.95,
              "education": 0.915,
              "gender": 0.67,
              "marital_status": 0.655,
              "workclass": 0.65,
              "race": 0.41,
          },
      ]
  
      counterfactual_explanations = CounterfactualExplanations(
          cf_examples_list=[],
          local_importance=unsorted_local_importance,
          summary_importance=None,
      )
  
      for index in range(0, len(unsorted_local_importance)):
          assert (
              unsorted_local_importance[index]
              == counterfactual_explanations.local_importance[index]
          )
          assert (
              sorted_local_importance[index]
              == counterfactual_explanations.local_importance[index]
          )
  
      for index in range(0, len(unsorted_local_importance)):
          assert list(unsorted_local_importance[index].keys()) != list(
              counterfactual_explanations.local_importance[index].keys()
          )
          assert list(sorted_local_importance[index].keys()) == list(
              counterfactual_explanations.local_importance[index].keys()
          )
  
file_path: DiCE/tests/test_counterfactual_explanations.py
imports: import json
  import pytest
  from raiutils.exceptions import UserConfigValidationException
  from dice_ml.counterfactual_explanations import CounterfactualExplanations
label_desc: Use image node_id 2 for calling the TestCounterfactualExplanations obj's underlying member method code with example usage: obj.test_sorted_local_importance_counterfactual_explanations() without return types