docstr: Test that they keys in the YAML have the same order as export_fields
docstr_tok: ["Test","that","they","keys","in","the","YAML","have","the","same","order","as","export_fields"]
code: def test_export_dataset_command_key_order(self, mock_g):
      """Test that they keys in the YAML have the same order as export_fields"""
      mock_g.user = security_manager.find_user("admin")
  
      example_db = get_example_database()
      example_dataset = _get_table_from_list_by_name(
          "energy_usage", example_db.tables
      )
      command = ExportDatasetsCommand([example_dataset.id])
      contents = dict(command.run())
  
      metadata = yaml.safe_load(
          contents["datasets/examples/energy_usage.yaml"]
      )
      assert list(metadata.keys()) == [
          "table_name",
          "main_dttm_col",
          "description",
          "default_endpoint",
          "offset",
          "cache_timeout",
          "schema",
          "sql",
          "params",
          "template_params",
          "filter_select_enabled",
          "fetch_values_predicate",
          "extra",
          "normalize_columns",
          "always_filter_main_dttm",
          "uuid",
          "metrics",
          "columns",
          "version",
          "database_uuid",
      ]
  
imports: from operator import itemgetter
  from typing import Any
  from unittest.mock import patch
  import pytest
  import yaml
  from sqlalchemy.exc import SQLAlchemyError
  from superset import db, security_manager
  from superset.commands.database.importers.v1 import ImportDatabasesCommand
  from superset.commands.dataset.create import CreateDatasetCommand
  from superset.commands.dataset.exceptions import DatasetInvalidError, DatasetNotFoundError, WarmUpCacheTableNotFoundError
  from superset.commands.dataset.export import ExportDatasetsCommand
  from superset.commands.dataset.importers import v0, v1
  from superset.commands.dataset.warm_up_cache import DatasetWarmUpCacheCommand
  from superset.commands.exceptions import CommandInvalidError
  from superset.commands.importers.exceptions import IncorrectVersionError
  from superset.connectors.sqla.models import SqlaTable
  from superset.models.core import Database
  from superset.models.slice import Slice
  from superset.utils.core import get_example_default_schema, override_user
  from superset.utils.database import get_example_database
  from tests.integration_tests.base_tests import SupersetTestCase
  from tests.integration_tests.fixtures.birth_names_dashboard import load_birth_names_dashboard_with_slices, load_birth_names_data
  from tests.integration_tests.fixtures.energy_dashboard import load_energy_table_data, load_energy_table_with_slice
  from tests.integration_tests.fixtures.importexport import database_config, database_metadata_config, dataset_cli_export, dataset_config, dataset_metadata_config, dataset_ui_export
  from tests.integration_tests.fixtures.world_bank_dashboard import load_world_bank_dashboard_with_slices, load_world_bank_data
label_desc: Use image node_id 4 for calling the TestExportDatasetsCommand obj's underlying member method code with example usage: obj.test_export_dataset_command_key_order(mock_g) without return types