# Path: native_tags/registry.py
# def register(self, bucket, name_or_func, func=None):
#     """
#     Add a function to the registry by name
#     """
#     assert bucket in self, 'Bucket %s is unknown' % bucket
#     if func is None and hasattr(name_or_func, '__name__'):
#         name = name_or_func.__name__
#         func = name_or_func
#     elif func:
#         name = name_or_func
#     if name in self[bucket]:
#         raise AlreadyRegistered('The function %s is already registered' % name)
# 
#     self[bucket][name] = func
# 
# class AlreadyRegistered(Exception):
#     "The function you are trying to register is already in the registry"
#     pass
# 
# Path: native_tags/nodes.py
# def get_cache_key(bucket, name, args, kwargs):
#     """
#     Gets a unique SHA1 cache key for any call to a native tag.
#     Use args and kwargs in hash so that the same arguments use the same key
#     """
#     u = ''.join(map(str, (bucket, name, args, kwargs)))
#     return 'native_tags.%s' % sha_constructor(u).hexdigest()


import datetime
        import math
        import hashlib
        import pygments
        import GChartWrapper
        import feedparser
        import markdown
from django.contrib.auth.models import User
from django.template import Template, Context, TemplateSyntaxError
from django.test import TestCase
from django.core.serializers import deserialize
from django.core.cache import cache
from native_tags.registry import register, AlreadyRegistered
from native_tags.nodes import get_cache_key
        from native_tags.nodes import split
        self._serialize('xml')
    
    def test_contains(self):
        t = "{% if_contains 'team' 'i' %}yup{% endif_contains %}"
        self.assertEqual(render(t), '')
    
    def test_divisible(self):
        t = "{% if_divisible_by 150 5 %}buzz{% endif_divisible_by %}"
        self.assertEqual(render(t), 'buzz')
    
    def test_startswith(self):
        t = "{% if_startswith 'python' 'p' %}yup{% endif_startswith %}"
        self.assertEqual(render(t), 'yup')
    
    def test_subset(self):
        t = "{% if_subset l1 l2 %}yup{% endif_subset %}"
        self.assertEqual(render(t, {'l1':[2,3], 'l2':range(5)}), 'yup')
    
    def test_superset(self):
        self.assertEqual(render("{% if_superset l1 l2 %}yup{% endif_superset %}",{'l1':range(5),'l2':[2,3]}),'yup')
    
    def test_endswith(self):
        self.assertEqual(render("{% if_endswith 'python' 'n' %}yup{% endif_endswith %}"), 'yup')
    
    def test_startswith_negate(self):
        t = "{% if_startswith 'python' 'p' negate %}yup{% endif_startswith %}"
        self.assertEqual(render(t), '')
    
    def test_startswith_negate_else(self):
        t = "{% if_startswith 'python' 'p' negate %}yup{% else %}nope{% endif_startswith %}"

# Path: native_tags/registry.py
# def register(self, bucket, name_or_func, func=None):
#     """
#     Add a function to the registry by name
#     """
#     assert bucket in self, 'Bucket %s is unknown' % bucket
#     if func is None and hasattr(name_or_func, '__name__'):
#         name = name_or_func.__name__
#         func = name_or_func
#     elif func:
#         name = name_or_func
#     if name in self[bucket]:
#         raise AlreadyRegistered('The function %s is already registered' % name)
# 
#     self[bucket][name] = func
# 
# class AlreadyRegistered(Exception):
#     "The function you are trying to register is already in the registry"
#     pass
# 
# Path: native_tags/nodes.py
# def get_cache_key(bucket, name, args, kwargs):
#     """
#     Gets a unique SHA1 cache key for any call to a native tag.
#     Use args and kwargs in hash so that the same arguments use the same key
#     """
#     u = ''.join(map(str, (bucket, name, args, kwargs)))
#     return 'native_tags.%s' % sha_constructor(u).hexdigest()


# Path: example_project/app/tests.py
import datetime
        import math
        import hashlib
        import pygments
        import GChartWrapper
        import feedparser
        import markdown
from django.contrib.auth.models import User
from django.template import Template, Context, TemplateSyntaxError
from django.test import TestCase
from django.core.serializers import deserialize
from django.core.cache import cache
from native_tags.registry import register, AlreadyRegistered
from native_tags.nodes import get_cache_key
        from native_tags.nodes import split

        self._serialize('xml')
    
    def test_contains(self):
        t = "{% if_contains 'team' 'i' %}yup{% endif_contains %}"
        self.assertEqual(render(t), '')
    
    def test_divisible(self):
        t = "{% if_divisible_by 150 5 %}buzz{% endif_divisible_by %}"
        self.assertEqual(render(t), 'buzz')
    
    def test_startswith(self):
        t = "{% if_startswith 'python' 'p' %}yup{% endif_startswith %}"
        self.assertEqual(render(t), 'yup')
    
    def test_subset(self):
        t = "{% if_subset l1 l2 %}yup{% endif_subset %}"
        self.assertEqual(render(t, {'l1':[2,3], 'l2':range(5)}), 'yup')
    
    def test_superset(self):
        self.assertEqual(render("{% if_superset l1 l2 %}yup{% endif_superset %}",{'l1':range(5),'l2':[2,3]}),'yup')
    
    def test_endswith(self):
        self.assertEqual(render("{% if_endswith 'python' 'n' %}yup{% endif_endswith %}"), 'yup')
    
    def test_startswith_negate(self):
        t = "{% if_startswith 'python' 'p' negate %}yup{% endif_startswith %}"
        self.assertEqual(render(t), '')
    
    def test_startswith_negate_else(self):
        t = "{% if_startswith 'python' 'p' negate %}yup{% else %}nope{% endif_startswith %}"

        self.assertEqual(render(t), 'nope')