code: def test_format_date():
      date = datetime.date(2016, 2, 7)
  
      # strftime format
      format = "%B %d, %Y"
      assert (
          i18n.format_date(format, date=date, language="")
          == "February 07, 2016"
      )
      assert (
          i18n.format_date(format, date=date, language="unknown")
          == "February 07, 2016"
      )
      assert (
          i18n.format_date(format, date=date, language="en")
          == "February 07, 2016"
      )
      assert (
          i18n.format_date(format, date=date, language="ja")
          == "2月 07, 2016"
      )
      assert (
          i18n.format_date(format, date=date, language="de")
          == "Februar 07, 2016"
      )
  
      # raw string
      format = "Mon Mar 28 12:37:08 2016, commit 4367aef"
      assert (
          i18n.format_date(format, date=date, language="en") == format
      )
  
      format = "%B %d, %Y, %H:%M:%S %I %p"
      datet = datetime.datetime(
          2016, 2, 7, 5, 11, 17, 0
      )  # NoQA: DTZ001
      assert (
          i18n.format_date(format, date=datet, language="en")
          == "February 07, 2016, 05:11:17 05 AM"
      )
  
      format = "%B %-d, %Y, %-H:%-M:%-S %-I %p"
      assert (
          i18n.format_date(format, date=datet, language="en")
          == "February 7, 2016, 5:11:17 5 AM"
      )
      format = "%x"
      assert (
          i18n.format_date(format, date=datet, language="en")
          == "Feb 7, 2016"
      )
      format = "%X"
      if BABEL_VERSION >= (2, 12):
          assert (
              i18n.format_date(format, date=datet, language="en")
              == "5:11:17\u202fAM"
          )
      else:
          assert (
              i18n.format_date(format, date=datet, language="en")
              == "5:11:17 AM"
          )
      assert (
          i18n.format_date(format, date=date, language="en")
          == "Feb 7, 2016"
      )
      format = "%c"
      if BABEL_VERSION >= (2, 12):
          assert (
              i18n.format_date(format, date=datet, language="en")
              == "Feb 7, 2016, 5:11:17\u202fAM"
          )
      else:
          assert (
              i18n.format_date(format, date=datet, language="en")
              == "Feb 7, 2016, 5:11:17 AM"
          )
      assert (
          i18n.format_date(format, date=date, language="en")
          == "Feb 7, 2016"
      )
  
      # timezone
      format = "%Z"
      assert (
          i18n.format_date(format, date=datet, language="en") == "UTC"
      )
      format = "%z"
      assert (
          i18n.format_date(format, date=datet, language="en") == "+0000"
      )
  
file_path: sphinx/tests/test_util/test_util_i18n.py
imports: import datetime
  import os
  import babel
  import pytest
  from babel.messages.mofile import read_mo
  from sphinx.errors import SphinxError
  from sphinx.util import i18n
label_desc: Use image node_id 5 for calling a global function with example usage: test_format_date() without return types