code: def test_sort_tasks(self):
      task_1 = self.dal.task.create(Task(self.task_input_dict))
      task_2 = self.dal.task.create(Task(self.task_input_dict))
  
      # Sorting of snapshot in descending
      items = self.dal.task.query(
          {"model_id": self.task_input_dict["model_id"]},
          sort_key="created_at",
          sort_order="descending",
      )
      assert items[0].created_at == task_2.created_at
  
      # Sorting of snapshot in ascending
      items = self.dal.task.query(
          {"model_id": self.task_input_dict["model_id"]},
          sort_key="created_at",
          sort_order="ascending",
      )
      assert items[0].created_at == task_1.created_at
  
      # Wrong order being passed in
      failed = False
      try:
          _ = self.dal.task.query(
              {"model_id": self.task_input_dict["model_id"]},
              sort_key="created_at",
              sort_order="wrong_order",
          )
      except InvalidArgumentType:
          failed = True
      assert failed
  
      # Wrong key and order being passed in
      failed = False
      try:
          _ = self.dal.task.query(
              {"model_id": self.task_input_dict["model_id"]},
              sort_key="wrong_key",
              sort_order="wrong_order",
          )
      except InvalidArgumentType:
          failed = True
      assert failed
  
      # wrong key and right order being passed in
      expected_items = self.dal.task.query(
          {"model_id": self.task_input_dict["model_id"]},
          sort_key="created_at",
          sort_order="ascending",
      )
      items = self.dal.task.query(
          {"model_id": self.task_input_dict["model_id"]},
          sort_key="wrong_key",
          sort_order="ascending",
      )
      expected_ids = [item.id for item in expected_items]
      ids = [item.id for item in items]
      assert set(expected_ids) == set(ids)
  
imports: from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import os
  import tempfile
  import platform
  from datetime import datetime
  from datmo.core.storage.driver.blitzdb_dal_driver import BlitzDBDALDriver
  from datmo.core.storage.local.dal import LocalDAL
  from datmo.core.entity.model import Model
  from datmo.core.entity.task import Task
  from datmo.core.util.exceptions import EntityNotFound, InvalidArgumentType
label_desc: Use image node_id 12 for calling the TestLocalDAL obj's underlying member method code with example usage: obj.test_sort_tasks() without return types