Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: third_party/jinja2/tests.py

Issue 23506004: Update Jinja2 (Python template library) to 2.7.1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/jinja2/sandbox.py ('k') | third_party/jinja2/utils.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/jinja2/tests.py
diff --git a/third_party/jinja2/tests.py b/third_party/jinja2/tests.py
index 50510b0d353791c5dd3c3fd213cfc1545a9576cc..48a3e06182973bf863a8bf979c030ef9b206a403 100644
--- a/third_party/jinja2/tests.py
+++ b/third_party/jinja2/tests.py
@@ -10,26 +10,14 @@
"""
import re
from jinja2.runtime import Undefined
-
-try:
- from collections import Mapping as MappingType
-except ImportError:
- import UserDict
- MappingType = (UserDict.UserDict, UserDict.DictMixin, dict)
-
-# nose, nothing here to test
-__test__ = False
+from jinja2._compat import text_type, string_types, mapping_types
number_re = re.compile(r'^-?\d+(\.\d+)?$')
regex_type = type(number_re)
-try:
- test_callable = callable
-except NameError:
- def test_callable(x):
- return hasattr(x, '__call__')
+test_callable = callable
def test_odd(value):
@@ -76,17 +64,17 @@ def test_none(value):
def test_lower(value):
"""Return true if the variable is lowercased."""
- return unicode(value).islower()
+ return text_type(value).islower()
def test_upper(value):
"""Return true if the variable is uppercased."""
- return unicode(value).isupper()
+ return text_type(value).isupper()
def test_string(value):
"""Return true if the object is a string."""
- return isinstance(value, basestring)
+ return isinstance(value, string_types)
def test_mapping(value):
@@ -94,12 +82,12 @@ def test_mapping(value):
.. versionadded:: 2.6
"""
- return isinstance(value, MappingType)
+ return isinstance(value, mapping_types)
def test_number(value):
"""Return true if the variable is a number."""
- return isinstance(value, (int, long, float, complex))
+ return isinstance(value, (int, float, complex))
def test_sequence(value):
« no previous file with comments | « third_party/jinja2/sandbox.py ('k') | third_party/jinja2/utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698