source: cows/trunk/cows/test/test_genshi_util.py @ 4008

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/cows/trunk/cows/test/test_genshi_util.py@4008
Revision 4008, 575 bytes checked in by spascoe, 11 years ago (diff)

New COWS distribution. See [4005] for description.

Line 
1"""
2Test functions that work with genshi templates.
3
4@author: Stephen Pascoe
5
6"""
7
8from cows.pylons.genshi_util import RenameElementFilter
9from genshi import XML, QName
10
11def test_renameElement():
12    """
13    Check that renameElementFilter renames the root element of a stream.
14
15    """
16    xmlStream = XML('''<foo xmlns="http://example.com" flub="2"><bar baz="1">fofof</bar></foo>''')
17
18    f = RenameElementFilter(QName('waze'))
19
20    xml = (xmlStream | f).render()
21
22    print xml
23
24    assert xml == '<waze xmlns="http://example.com" flub="2"><bar baz="1">fofof</bar></waze>'
Note: See TracBrowser for help on using the repository browser.