# Path: lighty/templates/templatefilters.py
# def sum(*args):
# def float_format_args_parse(func, raw_value, format):
# def do_float_format(value, digits, rounding):
# def floatformat(raw_value, format='0'):
# def floatround(raw_value, format="0"):
# def addslashes(value):
# def capfirst(value):
# def stringformat(value, format):
# def upper(value):
# def lower(value):
# def dictsort(value, key, order=''):
# def get(value, index):
# def first(value):
# def join(value, joiner):
# def last(value):
# def length(value):
# def random(value):
# def sort(value, order=''):
# def date(value, format):


import unittest
        import datetime
from decimal import Decimal
from lighty.templates import templatefilters
        name = 'stringformat(%s, "%s")' % (value, format)
        result = templatefilters.stringformat(value, format)
        self.assertResult(name, result, '%4f' % value)

    # list filters

    def testJoin(self):
        '''Test join template filter'''
        value = (1, 2, 3, 4)
        result = templatefilters.join(value, ',')
        self.assertResult('join(%s)' % str(value), result, '1,2,3,4')

    def testLength(self):
        '''Test length template filter'''
        value = (1, 2, 3, 4)
        result = templatefilters.length(value)
        self.assertResult('length(%s)' % str(value), result, 4)

    def testFirst(self):
        '''Test first template filter'''
        value = (1, 2, 3, 4)
        result = templatefilters.first(value)
        self.assertResult('first(%s)' % str(value), result, 1)
        value = {'first': 1, 'last': 4}
        result = templatefilters.first(value)
        self.assertResult('first(%s)' % str(value), result, 1)

    def testLast(self):
        '''Test last template filter'''
        value = (1, 2, 3, 4)

# Path: lighty/templates/templatefilters.py
# def sum(*args):
# def float_format_args_parse(func, raw_value, format):
# def do_float_format(value, digits, rounding):
# def floatformat(raw_value, format='0'):
# def floatround(raw_value, format="0"):
# def addslashes(value):
# def capfirst(value):
# def stringformat(value, format):
# def upper(value):
# def lower(value):
# def dictsort(value, key, order=''):
# def get(value, index):
# def first(value):
# def join(value, joiner):
# def last(value):
# def length(value):
# def random(value):
# def sort(value, order=''):
# def date(value, format):


# Path: tests/default_filters.py
import unittest
        import datetime
from decimal import Decimal
from lighty.templates import templatefilters

        name = 'stringformat(%s, "%s")' % (value, format)
        result = templatefilters.stringformat(value, format)
        self.assertResult(name, result, '%4f' % value)

    # list filters

    def testJoin(self):
        '''Test join template filter'''
        value = (1, 2, 3, 4)
        result = templatefilters.join(value, ',')
        self.assertResult('join(%s)' % str(value), result, '1,2,3,4')

    def testLength(self):
        '''Test length template filter'''
        value = (1, 2, 3, 4)
        result = templatefilters.length(value)
        self.assertResult('length(%s)' % str(value), result, 4)

    def testFirst(self):
        '''Test first template filter'''
        value = (1, 2, 3, 4)
        result = templatefilters.first(value)
        self.assertResult('first(%s)' % str(value), result, 1)
        value = {'first': 1, 'last': 4}
        result = templatefilters.first(value)
        self.assertResult('first(%s)' % str(value), result, 1)

    def testLast(self):
        '''Test last template filter'''
        value = (1, 2, 3, 4)

        result = templatefilters.last(value)