File: test_xml_func.kid

package info (click to toggle)
kid 0.9.6-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze, wheezy
  • size: 2,264 kB
  • ctags: 4,633
  • sloc: python: 7,417; makefile: 120; sh: 47; xml: 4
file content (47 lines) | stat: -rw-r--r-- 1,118 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?xml version='1.0' encoding='utf-8'?>

<?python def test_xml_global(): return XML('<a/><b/><c/>') ?>


<testdoc xmlns:py="http://purl.org/kid/ns#">

  <?python
  test_xml_local = test_xml_global
  # XXX: Uncommenting the following line should work, but doesn't.
  # (Results in an "unqualified exec is not allowed here" error.)
  # def test_xml_local(): return XML('<a/><b/><c/>')
  ?>

  <d py:def="test_xml_template()"><a/><b/><c/></d>

  <test>
    <attempt><r py:replace="test_xml_global()">abc</r></attempt>
    <expect><a/><b/><c/></expect>
  </test>

  <test>
    <attempt>${test_xml_global()}</attempt>
    <expect><a/><b/><c/></expect>
  </test>

  <test>
    <attempt><r py:replace="test_xml_local()">abc</r></attempt>
    <expect><a/><b/><c/></expect>
  </test>

  <test>
    <attempt>${test_xml_local()}</attempt>
    <expect><a/><b/><c/></expect>
  </test>

  <test>
    <attempt><r py:replace="test_xml_template()">abc</r></attempt>
    <expect><d><a/><b/><c/></d></expect>
  </test>

  <test>
    <attempt>${test_xml_template()}</attempt>
    <expect><d><a/><b/><c/></d></expect>
  </test>

</testdoc>