| | 205 | def test_ignorable_space(self): |
| | 206 | text = '<foo> Mess \n\n\n with me! </foo>' |
| | 207 | output = XML(text).render(XMLSerializer, encoding=None) |
| | 208 | self.assertEqual('<foo> Mess\n with me! </foo>', output) |
| | 209 | |
| | 210 | def test_cache_markup(self): |
| | 211 | loc = (None, -1, -1) |
| | 212 | stream = Stream([(Stream.START, (QName('foo'), Attrs()), loc), |
| | 213 | (Stream.TEXT, u'…', loc), |
| | 214 | (Stream.TEXT, Markup('…'), loc), |
| | 215 | (Stream.END, QName('foo'), loc)]) |
| | 216 | output = stream.render(XMLSerializer, encoding=None) |
| | 217 | self.assertEqual('<foo>&hellip;…</foo>', output) |
| | 218 | |
| | 219 | def test_cache_markup_strip_whitespace(self): |
| | 220 | loc = (None, -1, -1) |
| | 221 | stream = Stream([(Stream.START, (QName('foo'), Attrs()), loc), |
| | 222 | (Stream.TEXT, u'…', loc), |
| | 223 | (Stream.TEXT, Markup('…'), loc), |
| | 224 | (Stream.END, QName('foo'), loc)]) |
| | 225 | output = stream.render(XMLSerializer, encoding=None, |
| | 226 | strip_whitespace=False) |
| | 227 | self.assertEqual('<foo>&hellip;…</foo>', output) |
| | 228 | |