<s> from django . template . defaultfilters import slice_filter <EOL> from django . test import SimpleTestCase <EOL> from django . utils . safestring import mark_safe <EOL> from . . utils import setup <EOL> class SliceTests ( SimpleTestCase ) : <EOL> @ setup ( { '<STR_LIT>' : '<STR_LIT>' } ) <EOL> def test_slice01 ( self ) : <EOL> output = self . engine . render_to_string ( '<STR_LIT>' , { '<STR_LIT:a>' : '<STR_LIT>' , '<STR_LIT:b>' : mark_safe ( '<STR_LIT>' ) } ) <EOL> self . assertEqual ( output , '<STR_LIT>' ) <EOL> @ setup ( { '<STR_LIT>' : '<STR_LIT>' } ) <EOL> def test_slice02 ( self ) : <EOL> output = self . engine . render_to_string ( '<STR_LIT>' , { '<STR_LIT:a>' : '<STR_LIT>' , '<STR_LIT:b>' : mark_safe ( '<STR_LIT>' ) } ) <EOL> self . assertEqual ( output , '<STR_LIT>' ) <EOL> class FunctionTests ( SimpleTestCase ) : <EOL> def test_zero_length ( self ) : <EOL> self . assertEqual ( slice_filter ( '<STR_LIT>' , '<STR_LIT:0>' ) , '<STR_LIT>' ) <EOL> def test_index ( self ) : <EOL> self . assertEqual ( slice_filter ( '<STR_LIT>' , '<STR_LIT:1>' ) , '<STR_LIT:a>' ) <EOL> def test_negative_index ( self ) : <EOL> self . assertEqual ( slice_filter ( '<STR_LIT>' , '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> def test_range ( self ) : <EOL> self . assertEqual ( slice_filter ( '<STR_LIT>' , '<STR_LIT>' ) , '<STR_LIT:b>' ) <EOL> def test_range_multiple ( self ) : <EOL> self . assertEqual ( slice_filter ( '<STR_LIT>' , '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> def test_range_step ( self ) : <EOL> self . assertEqual ( slice_filter ( '<STR_LIT>' , '<STR_LIT>' ) , '<STR_LIT>' ) </s>
