Package oort :: Package test :: Module test_misc
[hide private]
[frames] | no frames]

Source Code for Module oort.test.test_misc

 1  # -*- coding: UTF-8 -*- 
 2  from oort.util._genshifilters import language_filtered_xml 
 3   
 4   
 5  XML = u""" 
 6  <span>XML.</span> 
 7  """ 
 8   
 9  XML_EN = u""" 
10  <span xml:lang="en">Testing.</span> 
11  """ 
12   
13  XML_SV = u""" 
14  <span xml:lang="sv">Testar.</span> 
15  """ 
16   
17  FULL_XML = u""" 
18  <div xml:lang="en">Testing.</div> 
19  <div xml:lang="sv">Testar.</div> 
20  """ 
21   
22  WRAPPED = u"""<rdf-wrapper> 
23      <p><em>XML</em>.</p> 
24  </rdf-wrapper>""" 
25   
26  WRAPPED_EN = u"""<rdf-wrapper xml:lang="en"> 
27      <p>Some content.</p> 
28      <p>Some <em>more</em> content.</p> 
29  </rdf-wrapper>""" 
30   
31  WRAPPED_SV = u"""<rdf-wrapper xml:lang="sv"> 
32      <p>Lite inneåll.</p> 
33      <p>Lite <em>mer</em> innehåll.</p> 
34  </rdf-wrapper>""" 
35   
36   
37 -def test_language_filtered_xml():
38 for lang in 'en', 'sv': 39 print "="*20, lang 40 for xml in (XML, XML_EN, XML_SV, FULL_XML, WRAPPED, WRAPPED_EN, WRAPPED_SV): 41 stream = language_filtered_xml(xml, lang) 42 print stream.render() 43 stream = language_filtered_xml([XML_EN, XML_SV], 'en')
44