Commits

Armin Ronacher committed 9e6400e

fixes some smaller problems for Jinja2 on Jython.

--HG--
branch : trunk

Comments (0)

Files changed (6)

 ^docs/_build
 ^(build|dist|Jinja2\.egg-info)/
 \.py[co]$
+\$py\.class$
 \.DS_Store$
-^env/
+^j?env/
 ^py3k/
 Jinja2 Changelog
 ================
 
+Version 2.2.1
+-------------
+(bugfix release, released on September 14th 2009)
+
+- fixes some smaller problems for Jinja2 on Jython.
+
 Version 2.2
 -----------
 (codename Kong, released on September 13th 2009)
 
 setup(
     name='Jinja2',
-    version='2.3',
+    version='2.2.1',
     url='http://jinja.pocoo.org/',
     license='BSD',
     author='Armin Ronacher',

tests/test_ext.py

 importable_object = 23
 
 
-_gettext_re = re.compile(r'_\((.*?)\)')
+_gettext_re = re.compile(r'_\((.*?)\)(?s)')
 
 
 class TestExtension(Extension):
 
     def filter_stream(self, stream):
         for token in stream:
-            if token.type is 'data':
+            if token.type == 'data':
                 for t in self.interpolate(token):
                     yield t
             else:
 
 def test_streamfilter_extension():
     env = Environment(extensions=[StreamFilterExtension])
-    env.globals['gettext'] = lambda x: x.title()
+    env.globals['gettext'] = lambda x: x.upper()
     tmpl = env.from_string('Foo _(bar) Baz')
-    assert tmpl.render() == 'Foo Bar Baz'
+    out = tmpl.render()
+    assert out == 'Foo BAR Baz'
 
 
 class WithExtension(Extension):

tests/test_filters.py

 
 def test_dictsort():
     tmpl = env.from_string(DICTSORT)
-    out = tmpl.render(foo={"a": 0, "b": 1, "c": 2, "A": 3})
-    assert out == ("[('a', 0), ('A', 3), ('b', 1), ('c', 2)]|"
-                   "[('A', 3), ('a', 0), ('b', 1), ('c', 2)]|"
-                   "[('a', 0), ('b', 1), ('c', 2), ('A', 3)]")
+    out = tmpl.render(foo={"aa": 0, "b": 1, "c": 2, "AB": 3})
+    assert out == ("[('aa', 0), ('AB', 3), ('b', 1), ('c', 2)]|"
+                   "[('AB', 3), ('aa', 0), ('b', 1), ('c', 2)]|"
+                   "[('aa', 0), ('b', 1), ('c', 2), ('AB', 3)]")
 
 
 def test_batch():

tests/test_various.py

 from jinja2.utils import Cycler
 from jinja2.exceptions import TemplateSyntaxError
 
+from nose import SkipTest
 from nose.tools import assert_raises
 
 env = Environment()
 
 
 def test_markup_leaks():
+    # this test only tests the c extension
+    if hasattr(escape, 'func_code'):
+        raise SkipTest()
     counts = set()
     for count in xrange(20):
         for item in xrange(1000):