code: def test_format():
      """Test format function"""
      assert template("foo {{ baz }}", baz="bar") == "foo bar"
      with raises(KeyError):
          assert template("foo {{ baz }}") == "foo baz"
  
      class Object(object):
          pass
  
      obj = Object()
      obj.a = 1
      obj.b = True
      obj.c = "3"
      assert (
          template("foo {{ o.a }} {{o.b}}-{{o.c}}", o=obj)
          == "foo 1 True-3"
      )
  
file_path: pygal/pygal/test/test_util.py
imports: from pytest import raises
  from pygal.util import _swap_curly, majorize, mergextend, minify_css, round_to_float, round_to_int, template, truncate
label_desc: Use image node_id 4 for calling a global function with example usage: test_format() without return types