# Path: jinja2/runtime.py
# class Undefined(object):
#     """The default undefined type.  This undefined type can be printed and
#     iterated over, but every other access will raise an :exc:`UndefinedError`:
# 
#     >>> foo = Undefined(name='foo')
#     >>> str(foo)
#     ''
#     >>> not foo
#     True
#     >>> foo + 42
#     Traceback (most recent call last):
#       ...
#     UndefinedError: 'foo' is undefined
#     """
#     __slots__ = ('_undefined_hint', '_undefined_obj', '_undefined_name',
#                  '_undefined_exception')
# 
#     def __init__(self, hint=None, obj=None, name=None, exc=UndefinedError):
#         self._undefined_hint = hint
#         self._undefined_obj = obj
#         self._undefined_name = name
#         self._undefined_exception = exc
# 
#     def _fail_with_undefined_error(self, *args, **kwargs):
#         """Regular callback function for undefined objects that raises an
#         `UndefinedError` on call.
#         """
#         if self._undefined_hint is None:
#             if self._undefined_obj is None:
#                 hint = '%r is undefined' % self._undefined_name
#             elif not isinstance(self._undefined_name, basestring):
#                 hint = '%r object has no element %r' % (
#                     self._undefined_obj.__class__.__name__,
#                     self._undefined_name
#                 )
#             else:
#                 hint = '%r object has no attribute %r' % (
#                     self._undefined_obj.__class__.__name__,
#                     self._undefined_name
#                 )
#         else:
#             hint = self._undefined_hint
#         raise self._undefined_exception(hint)
# 
#     __add__ = __radd__ = __mul__ = __rmul__ = __div__ = __rdiv__ = \
#     __truediv__ = __rtruediv__ = __floordiv__ = __rfloordiv__ = \
#     __mod__ = __rmod__ = __pos__ = __neg__ = __call__ = \
#     __getattr__ = __getitem__ = __lt__ = __le__ = __gt__ = __ge__ = \
#     __int__ = __float__ = __complex__ = __pow__ = __rpow__ = \
#         _fail_with_undefined_error
# 
#     def __str__(self):
#         return unicode(self).encode('utf-8')
# 
#     def __unicode__(self):
#         return u''
# 
#     def __len__(self):
#         return 0
# 
#     def __iter__(self):
#         if 0:
#             yield None
# 
#     def __nonzero__(self):
#         return False
# 
#     def __repr__(self):
#         return 'Undefined'


import re
from jinja2.runtime import Undefined

def test_even(value):
    """Return true if the variable is even."""
    return value % 2 == 0


def test_divisibleby(value, num):
    """Check if a variable is divisible by a number."""
    return value % num == 0


def test_defined(value):
    """Return true if the variable is defined:

    .. sourcecode:: jinja

        {% if variable is defined %}
            value of variable: {{ variable }}
        {% else %}
            variable is not defined
        {% endif %}

    See the :func:`default` filter for a simple way to set undefined
    variables.
    """
    return not isinstance(value, Undefined)


def test_undefined(value):
    """Like :func:`defined` but the other way round."""

# Path: jinja2/runtime.py
# class Undefined(object):
#     """The default undefined type.  This undefined type can be printed and
#     iterated over, but every other access will raise an :exc:`UndefinedError`:
# 
#     >>> foo = Undefined(name='foo')
#     >>> str(foo)
#     ''
#     >>> not foo
#     True
#     >>> foo + 42
#     Traceback (most recent call last):
#       ...
#     UndefinedError: 'foo' is undefined
#     """
#     __slots__ = ('_undefined_hint', '_undefined_obj', '_undefined_name',
#                  '_undefined_exception')
# 
#     def __init__(self, hint=None, obj=None, name=None, exc=UndefinedError):
#         self._undefined_hint = hint
#         self._undefined_obj = obj
#         self._undefined_name = name
#         self._undefined_exception = exc
# 
#     def _fail_with_undefined_error(self, *args, **kwargs):
#         """Regular callback function for undefined objects that raises an
#         `UndefinedError` on call.
#         """
#         if self._undefined_hint is None:
#             if self._undefined_obj is None:
#                 hint = '%r is undefined' % self._undefined_name
#             elif not isinstance(self._undefined_name, basestring):
#                 hint = '%r object has no element %r' % (
#                     self._undefined_obj.__class__.__name__,
#                     self._undefined_name
#                 )
#             else:
#                 hint = '%r object has no attribute %r' % (
#                     self._undefined_obj.__class__.__name__,
#                     self._undefined_name
#                 )
#         else:
#             hint = self._undefined_hint
#         raise self._undefined_exception(hint)
# 
#     __add__ = __radd__ = __mul__ = __rmul__ = __div__ = __rdiv__ = \
#     __truediv__ = __rtruediv__ = __floordiv__ = __rfloordiv__ = \
#     __mod__ = __rmod__ = __pos__ = __neg__ = __call__ = \
#     __getattr__ = __getitem__ = __lt__ = __le__ = __gt__ = __ge__ = \
#     __int__ = __float__ = __complex__ = __pow__ = __rpow__ = \
#         _fail_with_undefined_error
# 
#     def __str__(self):
#         return unicode(self).encode('utf-8')
# 
#     def __unicode__(self):
#         return u''
# 
#     def __len__(self):
#         return 0
# 
#     def __iter__(self):
#         if 0:
#             yield None
# 
#     def __nonzero__(self):
#         return False
# 
#     def __repr__(self):
#         return 'Undefined'


# Path: jinja2/tests.py
import re
from jinja2.runtime import Undefined


def test_even(value):
    """Return true if the variable is even."""
    return value % 2 == 0


def test_divisibleby(value, num):
    """Check if a variable is divisible by a number."""
    return value % num == 0


def test_defined(value):
    """Return true if the variable is defined:

    .. sourcecode:: jinja

        {% if variable is defined %}
            value of variable: {{ variable }}
        {% else %}
            variable is not defined
        {% endif %}

    See the :func:`default` filter for a simple way to set undefined
    variables.
    """
    return not isinstance(value, Undefined)


def test_undefined(value):
    """Like :func:`defined` but the other way round."""

    return isinstance(value, Undefined)