<s> import mock <EOL> from django . test import TestCase <EOL> from django . core . exceptions import ImproperlyConfigured <EOL> from fancypages import mixins <EOL> class TestTemplateNamesModelMixin ( TestCase ) : <EOL> def setUp ( self ) : <EOL> super ( TestTemplateNamesModelMixin , self ) . setUp ( ) <EOL> self . tmpl_lookup = mixins . TemplateNamesModelMixin ( ) <EOL> self . tmpl_lookup . _meta = mock . Mock ( ) <EOL> self . tmpl_lookup . _meta . module_name = '<STR_LIT>' <EOL> def test_raises_exception_if_not_configured ( self ) : <EOL> with self . assertRaises ( ImproperlyConfigured ) : <EOL> self . tmpl_lookup . get_template_names ( ) <EOL> def test_returns_specified_template_name_from_attribute ( self ) : <EOL> template_name = '<STR_LIT>' <EOL> self . tmpl_lookup . template_name = template_name <EOL> self . assertEquals ( <EOL> self . tmpl_lookup . get_template_names ( ) , [ template_name ] ) <EOL> def test_returns_template_name_from_attr_with_language_suffix ( self ) : <EOL> template_name = '<STR_LIT>' <EOL> self . tmpl_lookup . template_name = template_name <EOL> self . tmpl_lookup . language_code = '<STR_LIT>' <EOL> self . assertEquals ( <EOL> self . tmpl_lookup . get_template_names ( ) , <EOL> [ '<STR_LIT>' , template_name ] ) <EOL> def test_returns_template_name_from_attr_with_language_fallback ( self ) : <EOL> template_name = '<STR_LIT>' <EOL> self . tmpl_lookup . template_name = template_name <EOL> self . tmpl_lookup . language_code = '<STR_LIT>' <EOL> self . assertEquals ( <EOL> self . tmpl_lookup . get_template_names ( ) , <EOL> [ '<STR_LIT>' , '<STR_LIT>' , <EOL> template_name ] ) <EOL> def test_returns_templates_with_string_formatting ( self ) : <EOL> template_name = '<STR_LIT>' <EOL> self . tmpl_lookup . template_name = template_name <EOL> self . assertEquals ( <EOL> self . tmpl_lookup . get_template_names ( ) , <EOL> [ '<STR_LIT>' ] ) <EOL> def test_returns_templates_with_defaults_and_formatting ( self ) : <EOL> template_names = [ <EOL> '<STR_LIT>' , '<STR_LIT>' ] <EOL> self . tmpl_lookup . default_template_names = template_names <EOL> self . assertEquals ( <EOL> self . tmpl_lookup . get_template_names ( ) , <EOL> [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> def test_returns_templates_with_defaults_format_and_language ( self ) : <EOL> template_names = [ <EOL> '<STR_LIT>' , '<STR_LIT>' ] <EOL> self . tmpl_lookup . default_template_names = template_names <EOL> self . tmpl_lookup . language_code = '<STR_LIT>' <EOL> self . assertEquals ( <EOL> self . tmpl_lookup . get_template_names ( ) , <EOL> [ '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ] ) </s>
