<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<?python #
test1 = 'test1 value'
def test2():
  return 'test2 value'
?>
<testdoc xmlns:py="http://purl.org/kid/ns#">

  <test>
    <attempt>${test1}</attempt>
    <expect>test1 value</expect>
  </test>

  <test>
    <attempt>${test2()}</attempt>
    <expect>test2 value</expect>
  </test>

  <test>
    <attempt>${None}</attempt>
    <expect></expect>
  </test>

  <test>
    <attempt>${'test4'}</attempt>
    <expect>test4</expect>
  </test>

  <test>
    <attempt>${1234}</attempt>
    <expect>1234</expect>
  </test>

  <test>
    <attempt>${1234.5678}</attempt>
    <expect>1234.5678</expect>
  </test>

  <test>
    <attempt>${u'†©—'}</attempt>
    <expect>†©—</expect>
  </test>

  <test>
    <attempt><![CDATA[${'quick < CDATA test'}]]></attempt>
    <expect>quick &lt; CDATA test</expect>
  </test>

  <test>
    <attempt>hello ${'there'} this is ${None} a multi-part $test1</attempt>
    <expect>hello there this is  a multi-part test1 value</expect>
  </test>

  <test>
    <attempt>test $$escaping of $$ signs.</attempt>
    <expect>test $$escaping of $$ signs.</expect>
  </test>
  
  <?python
  msg      = u'ca\xe7\xe3o'
  msg_utf8 =  'ca\xc3\xa7\xc3\xa3o'
  msg_iso  =  'ca\xe7\xe3o'
  ?>

  <test>
    <attempt>${msg}</attempt>
    <expect>cação</expect>
  </test>
  <test>
    <attempt>${unicode(msg_utf8, 'utf-8')}</attempt>
    <expect>cação</expect>
  </test>
  <test>
    <attempt>${unicode(msg_iso, 'iso8859-1')}</attempt>
    <expect>cação</expect>
  </test>
  
</testdoc>
