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): |