code: def test_custom_formatting():
      class HasHTMLOnly(object):
          def __html__(self):
              return Markup("<foo>")
  
      class HasHTMLAndFormat(object):
          def __html__(self):
              return Markup("<foo>")
  
          def __html_format__(self, spec):
              return Markup("<FORMAT>")
  
      assert Markup("{0}").format(HasHTMLOnly()) == Markup("<foo>")
      assert Markup("{0}").format(HasHTMLAndFormat()) == Markup(
          "<FORMAT>"
      )
  
imports: import pytest
  from markupsafe import escape
  from markupsafe import escape_silent
  from markupsafe import Markup
  from markupsafe._compat import PY2
  from markupsafe._compat import text_type
label_desc: Use image node_id 11 for calling a global function with example usage: test_custom_formatting() and returns: Markup, Markup, Markup