class_docstr: Checks all functions of BlitzDBDALDriver
code: def test_query_sort_date_str(self):
      collection = "snapshot"
      self.database.set(
          collection,
          {
              "range_query4": datetime.datetime(2017, 1, 1).strftime(
                  "%Y-%m-%dT%H:%M:%S.%fZ"
              )
          },
      )
      self.database.set(
          collection,
          {
              "range_query4": datetime.datetime(2017, 2, 1).strftime(
                  "%Y-%m-%dT%H:%M:%S.%fZ"
              )
          },
      )
      self.database.set(
          collection,
          {
              "range_query4": datetime.datetime(2017, 3, 1).strftime(
                  "%Y-%m-%dT%H:%M:%S.%fZ"
              )
          },
      )
      # ascending
      items = self.database.query(
          collection,
          {
              "range_query4": {
                  "$gte": datetime.datetime(2017, 2, 1).strftime(
                      "%Y-%m-%dT%H:%M:%S.%fZ"
                  )
              }
          },
          sort_key="range_query4",
          sort_order="ascending",
      )
      assert items[0]["range_query4"] == datetime.datetime(
          2017, 2, 1
      ).strftime("%Y-%m-%dT%H:%M:%S.%fZ")
      # descending
      items = self.database.query(
          collection,
          {
              "range_query4": {
                  "$gte": datetime.datetime(2017, 2, 1).strftime(
                      "%Y-%m-%dT%H:%M:%S.%fZ"
                  )
              }
          },
          sort_key="range_query4",
          sort_order="descending",
      )
      assert items[0]["range_query4"] == datetime.datetime(
          2017, 3, 1
      ).strftime("%Y-%m-%dT%H:%M:%S.%fZ")
  
      # only sort_key is passed in with no sort_order
      failed = False
      try:
          _ = self.database.query(
              collection,
              {
                  "range_query4": {
                      "$gte": datetime.datetime(2017, 2, 1).strftime(
                          "%Y-%m-%dT%H:%M:%S.%fZ"
                      )
                  }
              },
              sort_key="range_query4",
          )
      except RequiredArgumentMissing:
          failed = True
      assert failed
  
      # only sort_order is passed in with no sort_key
      failed = False
      try:
          _ = self.database.query(
              collection,
              {
                  "range_query4": {
                      "$gte": datetime.datetime(2017, 2, 1).strftime(
                          "%Y-%m-%dT%H:%M:%S.%fZ"
                      )
                  }
              },
              sort_order="descending",
          )
      except RequiredArgumentMissing:
          failed = True
      assert failed
  
      # both passed and wrong sort order
      failed = False
      try:
          _ = self.database.query(
              collection,
              {
                  "range_query4": {
                      "$gte": datetime.datetime(2017, 2, 1).strftime(
                          "%Y-%m-%dT%H:%M:%S.%fZ"
                      )
                  }
              },
              sort_key="range_query4",
              sort_order="wrong_order",
          )
      except InvalidArgumentType:
          failed = True
      assert failed
  
      # both passed and both are wrong
      failed = False
      try:
          _ = self.database.query(
              collection,
              {
                  "range_query4": {
                      "$gte": datetime.datetime(2017, 2, 1).strftime(
                          "%Y-%m-%dT%H:%M:%S.%fZ"
                      )
                  }
              },
              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.database.query(
          collection,
          {
              "range_query4": {
                  "$gte": datetime.datetime(2017, 2, 1).strftime(
                      "%Y-%m-%dT%H:%M:%S.%fZ"
                  )
              }
          },
          sort_key="range_query4",
          sort_order="ascending",
      )
      items = self.database.query(
          collection,
          {
              "range_query4": {
                  "$gte": datetime.datetime(2017, 2, 1).strftime(
                      "%Y-%m-%dT%H:%M:%S.%fZ"
                  )
              }
          },
          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 datetime
  import platform
  from datmo.core.storage.driver.blitzdb_dal_driver import BlitzDBDALDriver
  from datmo.core.util.exceptions import EntityNotFound, InvalidArgumentType, RequiredArgumentMissing
  from datmo.core.util.misc_functions import create_unique_hash
label_desc: Use image node_id 22 for calling the TestBlitzDBDALDriver obj's underlying member method code with example usage: obj.test_query_sort_date_str() without return types