From e5976d9f22b2579cf679ab8aeba79fd107c9b48a Mon Sep 17 00:00:00 2001 From: "sgunderson@bigfoot.com" <> Date: Wed, 6 Sep 2006 16:52:21 +0200 Subject: [PATCH] Add full range of Python regression tests. --- python/attribute.py | 13 +++++++++++++ python/attribute2.py | 13 +++++++++++++ python/clone.py | 13 +++++++++++++ python/include.py | 12 ++++++++++++ 4 files changed, 51 insertions(+) create mode 100644 python/attribute.py create mode 100644 python/attribute2.py create mode 100644 python/clone.py create mode 100644 python/include.py diff --git a/python/attribute.py b/python/attribute.py new file mode 100644 index 0000000..0127e80 --- /dev/null +++ b/python/attribute.py @@ -0,0 +1,13 @@ +#! /usr/bin/python +import xmltemplate + +doc = xmltemplate.process_file("../xml/clone.xml", { + 'color': 'blue', + '#things': ( + { "li": "Raindrops on roses", "li/class": "even" }, + { "li": "Whiskers on kittens", "li/class": "odd" }, + { "li": "Bright copper kettles", "li/class": "even" }, + { "li": "Warm, woolen mittens", "li/class": "odd" } + ) +}) +print doc.toxml() diff --git a/python/attribute2.py b/python/attribute2.py new file mode 100644 index 0000000..d7caca6 --- /dev/null +++ b/python/attribute2.py @@ -0,0 +1,13 @@ +#! /usr/bin/python +import xmltemplate + +doc = xmltemplate.process_file("../xml/clone.xml", { + "color": "blue", + "#things": xmltemplate.alternate("li/class", ( + { "li": "Raindrops on roses" }, + { "li": "Whiskers on kittens" }, + { "li": "Bright copper kettles" }, + { "li": "Warm, woolen mittens"}, + ), "odd", "even") +}); +print doc.toxml() diff --git a/python/clone.py b/python/clone.py new file mode 100644 index 0000000..65e9519 --- /dev/null +++ b/python/clone.py @@ -0,0 +1,13 @@ +#! /usr/bin/python +import xmltemplate + +doc = xmltemplate.process_file("../xml/clone.xml", { + 'color': 'blue', + '#things': ( + { 'li': 'Raindrops on roses' }, + { 'li': 'Whiskers on kittens' }, + { 'li': 'Bright copper kettles' }, + { 'li': 'Warm, woolen mittens' } + ) +}) +print doc.toxml() diff --git a/python/include.py b/python/include.py new file mode 100644 index 0000000..0c87fba --- /dev/null +++ b/python/include.py @@ -0,0 +1,12 @@ +#! /usr/bin/python +import xmltemplate + +doc = xmltemplate.process_file("../xml/included.xml", { + "color": "red" +}, False) +master = xmltemplate.process_file("../xml/master.xml", { + "title": "Main HTML title", + "h1": "Nice heading here", + "contents": doc +}); +print master.toxml() -- 2.39.2