<s> import os <EOL> from django . template import Context <EOL> from django . template . engine import Engine <EOL> from django . test import SimpleTestCase <EOL> from . utils import ROOT , TEMPLATE_DIR <EOL> OTHER_DIR = os . path . join ( ROOT , '<STR_LIT>' ) <EOL> class RenderToStringTest ( SimpleTestCase ) : <EOL> def setUp ( self ) : <EOL> self . engine = Engine ( dirs = [ TEMPLATE_DIR ] ) <EOL> def test_basic_context ( self ) : <EOL> self . assertEqual ( <EOL> self . engine . render_to_string ( '<STR_LIT>' , { '<STR_LIT>' : '<STR_LIT:test>' } ) , <EOL> '<STR_LIT>' , <EOL> ) <EOL> class LoaderTests ( SimpleTestCase ) : <EOL> def test_origin ( self ) : <EOL> engine = Engine ( dirs = [ TEMPLATE_DIR ] , debug = True ) <EOL> template = engine . get_template ( '<STR_LIT>' ) <EOL> self . assertEqual ( template . origin . template_name , '<STR_LIT>' ) <EOL> def test_loader_priority ( self ) : <EOL> """<STR_LIT>""" <EOL> loaders = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] <EOL> engine = Engine ( dirs = [ OTHER_DIR , TEMPLATE_DIR ] , loaders = loaders ) <EOL> template = engine . get_template ( '<STR_LIT>' ) <EOL> self . assertEqual ( template . render ( Context ( ) ) , '<STR_LIT>' ) <EOL> def test_cached_loader_priority ( self ) : <EOL> """<STR_LIT>""" <EOL> loaders = [ <EOL> ( '<STR_LIT>' , [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] ) , <EOL> ] <EOL> engine = Engine ( dirs = [ OTHER_DIR , TEMPLATE_DIR ] , loaders = loaders ) <EOL> template = engine . get_template ( '<STR_LIT>' ) <EOL> self . assertEqual ( template . render ( Context ( ) ) , '<STR_LIT>' ) <EOL> template = engine . get_template ( '<STR_LIT>' ) <EOL> self . assertEqual ( template . render ( Context ( ) ) , '<STR_LIT>' ) </s>
