Changeset 89:757b097c61a5 for relatorio/tests/test_odt.py
- Timestamp:
- 01/15/09 07:38:25 (19 months ago)
- Branch:
- default
- Files:
-
- 1 modified
-
relatorio/tests/test_odt.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
relatorio/tests/test_odt.py
r81 r89 12 12 # This program is distributed in the hope that it will be useful, but WITHOUT 13 13 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 14 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 15 15 # details. 16 16 # … … 37 37 catalog = {'Mes collègues sont:': 'My collegues are:', 38 38 'Bonjour,': 'Hello,', 39 'Je suis un test de templating en odt.': 39 'Je suis un test de templating en odt.': 40 40 'I am an odt templating test', 41 41 'Felix da housecat': unicode('Félix le chat de la maison', … … 55 55 'last_name': unicode('Møller', 'utf8'), 56 56 'ville': unicode('Liège', 'utf8'), 57 'friends': [{'first_name': u'Camille', 57 'friends': [{'first_name': u'Camille', 58 58 'last_name': u'Salauhpe'}, 59 59 {'first_name': u'Mathias', … … 81 81 <text:a xlink:href="relatorio://foo">foo</text:a> 82 82 </b:a>''' % 'urn:text' 83 parsed = self.oot.insert_directives(xml) 83 parsed = self.oot.insert_directives(xml) 84 84 root = lxml.etree.parse(StringIO(xml)).getroot() 85 85 root_parsed = lxml.etree.parse(parsed).getroot() 86 eq_(root_parsed[0].attrib['{http://genshi.edgewall.org/}replace'], 86 eq_(root_parsed[0].attrib['{http://genshi.edgewall.org/}replace'], 87 87 'foo') 88 88 … … 144 144 def test_regexp(self): 145 145 "Testing the regexp used to find relatorio tags" 146 regexp = re.compile(GENSHI_EXPR) 147 group = regexp.match('for each="foo in bar"').groups() 148 eq_(group, ('for each="foo in bar"', None, 'for', ' each="foo in bar"', 149 'each', 'foo in bar')) 150 group = regexp.match('foreach="foo in bar"').groups() 151 eq_(group, ('foreach="foo in bar"', None, None, None, None, None)) 152 group = regexp.match('/for').groups() 153 eq_(group, ('/for', '/', 'for', '', None, None)) 154 group = regexp.match('/for ').groups() 155 eq_(group, ('/for ', '/', 'for', '', None, None)) 156 group = regexp.match('formatLang("en")').groups() 157 eq_(group, ('formatLang("en")', None, None, None, None, None)) 146 # a valid expression 147 group = GENSHI_EXPR.match('for each="foo in bar"').groups() 148 eq_(group, (None, 'for', 'each', 'foo in bar')) 149 150 # invalid expr 151 group = GENSHI_EXPR.match('foreach="foo in bar"').groups() 152 eq_(group, (None, None, None, None)) 153 154 # valid closing tags 155 group = GENSHI_EXPR.match('/for').groups() 156 eq_(group, ('/', 'for', None, None)) 157 group = GENSHI_EXPR.match('/for ').groups() 158 eq_(group, ('/', 'for', None, None)) 159 160 # another non matching expr 161 group = GENSHI_EXPR.match('formatLang("en")').groups() 162 eq_(group, (None, None, None, None)) 158 163 159 164 def test_str(self):
