diff genshi/filters/tests/transform.py @ 958:6fc92535c888 experimental-performance-improvement-exploration

Be more careful about what is passed into streams as events and remove many uses of _ensure as a result. An ATTRS event is added for handling Attributes returned by gensh.path.select().
author hodgestar
date Tue, 13 Mar 2012 03:03:02 +0000
parents 1e8c33345e52
children
line wrap: on
line diff
--- a/genshi/filters/tests/transform.py
+++ b/genshi/filters/tests/transform.py
@@ -17,7 +17,7 @@
 
 from genshi import HTML
 from genshi.builder import Element
-from genshi.core import START, END, TEXT, QName, Attrs
+from genshi.core import START, END, TEXT, QName, Attrs, _text_event
 from genshi.filters.transform import Transformer, StreamBuffer, ENTER, EXIT, \
                                      OUTSIDE, INSIDE, ATTR, BREAK
 import genshi.filters.transform
@@ -737,7 +737,7 @@
         count = [0]
         def content():
             count[0] += 1
-            yield '%2i.' % count[0]
+            yield _text_event('%2i.' % count[0])
         self.assertEqual(
             self._apply('*', content),
             [(None, START, u'root'),
@@ -841,7 +841,7 @@
         count = [0]
         def content():
             count[0] += 1
-            yield '%2i.' % count[0]
+            yield _text_event('%2i.' % count[0])
         self.assertEqual(
             self._apply('foo/text()', content),
             [(None, 'START', u'root'),
@@ -950,7 +950,7 @@
         count = [0]
         def content():
             count[0] += 1
-            yield '%2i.' % count[0]
+            yield _text_event('%2i.' % count[0])
         self.assertEqual(
             self._apply('foo/text()', content),
             [(None, 'START', u'root'),
@@ -1056,7 +1056,7 @@
         count = [0]
         def content():
             count[0] += 1
-            yield '%2i.' % count[0]
+            yield _text_event('%2i.' % count[0])
         self.assertEqual(
             self._apply('foo', content),
             [(None, 'START', u'root'),
@@ -1162,7 +1162,7 @@
         count = [0]
         def content():
             count[0] += 1
-            yield '%2i.' % count[0]
+            yield _text_event('%2i.' % count[0])
         self.assertEqual(
             self._apply('foo', content),
             [(None, 'START', u'root'),
Copyright (C) 2012-2017 Edgewall Software