# 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.assert_('add' in register['function'])
        register.unregister('function', 'add')
        self.assert_(not 'add' in register['function'])
       
    def test_inclusion(self):
        self.assertEqual(render('{% myinc cheese %}'), 'im just here for the cheese')
    
    def test_map_builtins(self):
        self.assertEqual(render('{% map len l1 l2 l3 %}', {'l1':[1], 'l2':[1,2], 'l3':[1,2,3]}), '[1, 2, 3]')
    
    def test_smartypants(self):
        # this should b bombing, but i get DEBUG as False when testing despite the settings (just in testing?)
        self.assertEqual(render('{{ value|smartypants }}', {'value': 'wtf'}), 'wtf')
        
    def test_custom_if(self):
        self.assertEqual(render('{% ifsomething %}yup{% endifsomething %}'), 'yup')
    
    def test_filter_faker(self):
        self.assertRaises(TemplateSyntaxError, render, '{% sha1 "my | filter | faker" %}')
    
    def test_math(self):
        self.assertAlmostEqual(float(render('{% acos .3 %}')), 1.26610367278)
        self.assertEqual(float(render('{{ 1.5|floor }}')), 1.)
        self.assertEqual(float(render('{{ 4|sqrt }}')), 2.)
        self.assertAlmostEqual(float(render('{{ 180|radians }}')), math.pi)
    
    def test_native_debug(self):
        self.assertEqual(render('{% native_debug as debug %}{{ debug.keys|safe }}'), "['function', 'comparison', 'filter', 'block']")
        
    def test_cache(self):

# 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.assert_('add' in register['function'])
        register.unregister('function', 'add')
        self.assert_(not 'add' in register['function'])
       
    def test_inclusion(self):
        self.assertEqual(render('{% myinc cheese %}'), 'im just here for the cheese')
    
    def test_map_builtins(self):
        self.assertEqual(render('{% map len l1 l2 l3 %}', {'l1':[1], 'l2':[1,2], 'l3':[1,2,3]}), '[1, 2, 3]')
    
    def test_smartypants(self):
        # this should b bombing, but i get DEBUG as False when testing despite the settings (just in testing?)
        self.assertEqual(render('{{ value|smartypants }}', {'value': 'wtf'}), 'wtf')
        
    def test_custom_if(self):
        self.assertEqual(render('{% ifsomething %}yup{% endifsomething %}'), 'yup')
    
    def test_filter_faker(self):
        self.assertRaises(TemplateSyntaxError, render, '{% sha1 "my | filter | faker" %}')
    
    def test_math(self):
        self.assertAlmostEqual(float(render('{% acos .3 %}')), 1.26610367278)
        self.assertEqual(float(render('{{ 1.5|floor }}')), 1.)
        self.assertEqual(float(render('{{ 4|sqrt }}')), 2.)
        self.assertAlmostEqual(float(render('{{ 180|radians }}')), math.pi)
    
    def test_native_debug(self):
        self.assertEqual(render('{% native_debug as debug %}{{ debug.keys|safe }}'), "['function', 'comparison', 'filter', 'block']")
        
    def test_cache(self):

        k = get_cache_key('function', 'date', (), {})